Integer division and remainder of an integer number by a natural number

Write a program that reads an integer number aa and a natural number bb, with b>0b > 0, and prints the integer division dd and the remainder rr of aa divided by bb.

Remember that, by definition, dd i rr must be the only integer numbers such that 0r<b0 \le r < b and db+r=ad \cdot b + r = a.

Input

Input consists of aa and bb, with b>0b > 0.

Output

Print a line with the integer division and the remainder of aa divided by bb, separated by a space.

Observation

Depending on the programming language that you use, maybe you will need to modify a bit your program for the exercise problem://problemsjutge.org:problems/p1/jpetit/divmod.pbm to make it properly work with negative aa’s.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:58:08.324Z

© Jutge.org, 2006–2026.
https://jutge.org