In previous blog see saw how to get the Difference of two numbers.

In today's blog we will see how to get the product of two numbers.

Sample input :-

     7 6

Sample output :-

     42

Algorithm :-

  1. Start.
  2. Get the input of two numbers num1 and num2 in integer format.
  3. print the product 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("Product 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 multiplying the two numbers.
Output :-
  1. Program screenshot


  2. Output screenshot


Now lets see how to get the product of two decimal numbers.

Sample input :-

     8.0 3.0

Sample output :-

     24.00

Algorithm :-

  1. Start.
  2. Get the input of two numbers num1 and num2 in decimal format.
  3. print the product of two numbers.
  4. Stop.
Program :-
  
     num1 = float(input("Enter the number 1: "))
     
     num2 = float(input("Enter the number 2: "))

     print("Product of two numbers",num1*num2)

Explanation :-
  1. num1 is a variable which stores the given number which we give in decimal format because by default the input() reads the input as string so we use float() to convert that value to decimal. 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 decimal format.
  3. print() is a function to print the output by multiplying the two numbers.
Output :-
  1. Program screenshot


  2. Output screenshot

In next blog, we will see how to do division of two numbers in python.