All Arithmetic calculation (Addition, Subtraction, Multiplication, Division) using Python simple steps-2019

All Arithmetic calculation (Addition, Subtraction, Multiplication, Division) using Python


  • Now i am going to show you to find all arithmetic calculation at once with user value using python.
  • Lets start with explanation and example program.

Aim

  • To create arithmetic calculation program using python.

Procedure 

  1. Open Python IDLE setup and create new file and save as arithmetic.py
  2.  Get two values from the user using input()-function.
  3. And do the arithmetic calculation (Addition, Subtraction, Multiplication, Division), sum=a+b, sub=a-b, mul=a*b, div=a/b.
  4. Print the value using print()- function. 
  5. Run the program using F5. 

Explain with Program

// Arithmetic Calculation //
a=int(input("Enter First Value:"))
b=int(input("Enter Second Value:"))
sum=a+b
sub=a-b
mul=a*b
div=a/b
print("First Number:",a)
print("Second Number:",b)
print("Arithmetic calculation at once")
print("Addition :",a,"+",b,"=",sum)
print("Subtraction :",a,"-",b,"=",sub)
print("Multiplication :",a,"*",b,"=",mul)
print("Division :",a,"/",b,"=",div)

Code with explanation 

..............
a=int(input("Enter First Value:"))
b=int(input("Enter Second Value:"))
............ 
  1. Get value (a=?)from user.
  2. Get value (b=?)from user. 
.................
sum=a+b
sub=a-b
mul=a*b
div=a/b
..............

  1. sum - addition of a and b.
  2. sub- subtraction of a and .
  3. mul- multiplication of a and b
  4. div-division of a and b.
 .....................
print("First Number:",a)
print("Second Number:",b)
print("Arithmetic calculation at once")
print("Addition :",a,"+",b,"=",sum)
print("Subtraction :",a,"-",b,"=",sub)
print("Multiplication :",a,"*",b,"=",mul)
print("Division :",a,"/",b,"=",div)
...........................


  1. print function of a,b value. 
  2. print addition.
  3. print subtraction.
  4. print multiplication.
  5. print division. 

Output

Enter First Value: 10
Enter Second Value: 5
First Number:10
Second Number:5
Arithmetic calculation at once
Addition: 10+5 = 15
Subtraction: 10-5 = 5
Multiplication: 10*5 = 50
Division: 10/5 = 2

You may also check Python Tips
Also check HTML & JS 

If you any doubts, Please let me know

Previous Post Next Post

Contact Form