23. Sharing Laddoos

Acceptance — 0 accepted 0 submissions

Easy
BasicsMath
No companies listed
Grandma made n laddoos for Diwali and wants to share them equally among k grandchildren. Every child must get the same number of laddoos, and the extra ones go back into the dabba.

Find how many laddoos each child gets and how many are left in the dabba.

Input Format
A single line with two integers n and k.

Output Format
Print the laddoos per child on the first line and the leftover laddoos on the second line.

Constraints
• 0 ≤ n ≤ 10^9
• 1 ≤ k ≤ 10^6

Example 1

Input
17 5
Output
3
2

Explanation 5 × 3 = 15, so each child gets 3 and 2 are left.

Example 2

Input
20 4
Output
5
0

Explanation Shared perfectly: 5 each, 0 left.

Example 3

Input
3 7
Output
0
3

Explanation Fewer laddoos than children: everyone gets 0 and all 3 stay in the dabba.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
3 2
No results yet
Run your code to test it against the sample cases.
Problem List