a = 17
b = 5
remainder = a % b
print(remainder)
#source code --> clcoding.com
Step-by-Step Explanation:
Assign Values to Variables:
a = 17
b = 5
We store the number 17 in a variable a.
We store the number 5 in a variable b.
Find the Remainder Using % Operator:
remainder = a % b
The % (modulus) operator finds the remainder when one number is divided by another.
Since 17 ÷ 5 gives a quotient of 3 and a remainder of 2, we get:
17 % 5 = 2
The result 2 is stored in the variable remainder.
Print the Result:
print(remainder)
The print() function displays the value of remainder on the screen.
Since remainder = 2, the output will be:
2
Final Output:
2
0 Comments:
Post a Comment