0% found this document useful (0 votes)
4 views2 pages

Python Program 2

The document contains several Python programs that perform basic arithmetic operations. These include calculating the average of three numbers, summing two numbers, performing division, subtracting two numbers, and finding the area of a triangle. Each program prompts the user for input and displays the result.

Uploaded by

saatatyamalhotra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Program 2

The document contains several Python programs that perform basic arithmetic operations. These include calculating the average of three numbers, summing two numbers, performing division, subtracting two numbers, and finding the area of a triangle. Each program prompts the user for input and displays the result.

Uploaded by

saatatyamalhotra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python programs

# Program to find the average of three numbers

num1 = int(input("Enter first number: "))

num2 = int(input("Enter second number: "))

num3 = int(input("Enter third number: "))

average = (num1 + num2 + num3) / 3

print("The average of the three numbers is:", average)

#Program to find sum of 2 numbers

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

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

sum = num1 + num2

print("The sum is:", sum)

#Program to find division

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

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

quotient = num1 // num2

print("The result of division is:", quotient)

#Program of subtraction

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

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

difference = num1 - num2

print("The result of subtraction is:", difference)


#Program to find area of triangle

base = int(input("Enter the base of the triangle: "))

height = int(input("Enter the height of the triangle: "))

area = 0.5 * base * height

print("The area of the triangle is:", area)

You might also like