In previous blog we see saw how to divide two numbers

In today's blog we will see how to get the modulo (i.e remainder) of two numbers.

Sample input :-

     10 5

Sample output :-

     0

Algorithm :-

  1. Start.
  2. Get the input of two numbers num1 and num2 in integer format.
  3. print the remainder of two numbers.
  4. Stop.

Now lets see this in code with explanation.

Program :-

     num1 = int(input("Enter the number 1: "))

     num2 = int(input("Enter the number 2: "))

     print("Remainder of two numbers:",num1%num2)

Explanation :-

  1. num1 is a variable which stores the given number which we give in integer format because by default the input() reads the input as string so we use int() to convert that value to integer. Inside the input we can also give the text to the user so that user knows what should we given as input.
  2. Similarly, num2 is also a variable which stores the second number in integer format.
  3. print() is a function to print the output by giving the remainder the two numbers.
Output :-
  1. Program screenshot:-


  2. Output screenshot:-

In next blog, we will see how to check if two numbers are equal.