Arithmetic operation using python in windows.
In my previous post , I have written how to install python in windows and add plugin into eclipse.
In this post I am going to explain simple arithmetic operations.
Step 1: Open eclipse - File - New - PyDev Project - arithmeticoperation_test
Step 2: Right click on the - src - New- PyDevModule- ArithmeticOperation
Step 3:Paste below code into ArithmeticOperation.py file.
Step 4: Right click on the program-Run As- Python Run
Step 5: output as follows
In my previous post , I have written how to install python in windows and add plugin into eclipse.
In this post I am going to explain simple arithmetic operations.
Step 1: Open eclipse - File - New - PyDev Project - arithmeticoperation_test
Step 2: Right click on the - src - New- PyDevModule- ArithmeticOperation
Step 3:Paste below code into ArithmeticOperation.py file.
''' Created on 07-Dec-2015 @author: rajusiva ''' a = input("Enter a value:") b = input("Enter b value:") print("Addition of 2 values is[",int(a)+int(b),"]") print("subtract of 2 values is[",int(a)-int(b),"]") print("Multiply of 2 values is[",int(a)*int(b),"]") print("Division of 2 values is[",int(a)/int(b),"]") print("Exponent of 2 values is[",int(a)**int(b),"]") print("Modules of 2 values is[",int(a)%int(b),"]") print("Floor Division of 2 values is[",int(a)//int(b),"]")
Step 4: Right click on the program-Run As- Python Run
Step 5: output as follows
Enter a value:25 Enter b value:10 Addition of 2 values is[ 35 ] subtract of 2 values is[ 15 ] Multiply of 2 values is[ 250 ] Division of 2 values is[ 2.5 ] Exponent of 2 values is[ 95367431640625 ] Modules of 2 values is[ 5 ] Floor Division of 2 values is[ 2 ]