For example:
>>> print divmod(177,10)
(17, 7)
Task:
- Read in two integers, a and b, and print three lines.
- The first line is the integer division a//b (While using Python2 remember to import division from __future__).
- The second line is the result of the modulo operator: a%b.
- The third line prints the divmod of a and b.
- The first line contains the first integer, a, and the second line contains the second integer, b.
- Print the result as described above.
177
10Sample Output:
17
7
(17, 7)Solution:
a=int(input())
b=int(input())
print(a//b,a%b,divmod(a,b),sep='\n')
No comments:
Post a Comment