Python program to do arithmetical operationsThe arithmetic operations are performed by calculator where we can perform addition, subtraction, multiplication and division. This example shows the basic arithmetic operations i.e.
Let's understand the following example. Example - Output: Enter first number: 10 Enter second number: 20 The sum of 10 and 20 is 30.0 Explanation - In the above code, we have taken the user input as an integer using the input() function. Then, we have performed the arithmetical operation on the given numbers and print the result using the print statement. We used the format() method to format the string Example 1: Output: Enter first number: 10 Enter second number: 20 The subtraction of 10 and 20 is -10 Example 2: Output: Enter first number: 10 Enter second number: 20 The multiplication of 10 and 20 is 200 Example 3: Output: Enter first number: 10 Enter second number: 20 The division of 10 and 20 is 0.5 Next TopicPython Area of a Triangle |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India