Exercise 13
Write a Python algorithm that asks the user to input two integers 'a' and 'b' and to display the quotient and the remainder of the Euclidean division of 'a' by 'b'.
Solution
# Ask the user to enter a value of the integers a and b a = int(input("Type a value of the integer a : ")) b = int(input("Type a value of the integer b : ")) q = a//b # compute the quotient of euclidean division r = a%b # compute the remainder of euclidean division print("The quotient of euclidean division of a by b is : q = ", q) print("The remainder of euclidean division of a by b is : r = ", r)
Younes Derfoufi
my-courses.net
[…] Exercise 13 || Solution […]