Integer division and remainder of two natural numbers P48107


Statement
 

pdf   zip

Write a program that reads two natural numbers aa and 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

Although the conditions for the input of this exercise prevent divisions by zero, check what happens to your program in that case.

Public test cases
  • Input

    32 6
    

    Output

    5 2
    
  • Input

    30 15
    

    Output

    2 0
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Pascal Python
    User solutions
    Ada C C++ Erlang Haskell Java JavaScript Lisp Lua Perl PHP Python Ruby Rust Zig