In this Mod Divmod solution, we need to develop a python program that can read an integer input containing two lines. and then we need to print the division and module operator on the output screen.

HackerRank Mod Divmod solution in python


Problem solution in Python 2 programming.

a = int(raw_input())
b = int(raw_input())
print a/b
print a%b
print divmod(a,b)


Problem solution in Python 3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
print('{0}\n{1}\n({0}, {1})'.format(*divmod(int(input()), int(input()))))


Problem solution in pypy programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
from __future__ import division

a = input()
b = input()
print a//b
print a%b
print divmod(a,b)


Problem solution in pypy3 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(input())
b = int(input())

print(a//b)
print(a%b)
print(divmod(a,b))