0% found this document useful (0 votes)
3 views

Basic Python Programs

The document contains a series of Python programs that perform basic arithmetic operations and geometric calculations. Each program prompts the user for input, processes the data, and prints the results, including operations like sum, difference, product, division, and calculations for area and perimeter of rectangles and squares. It serves as a simple guide for beginners to understand input handling and basic mathematical operations in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Basic Python Programs

The document contains a series of Python programs that perform basic arithmetic operations and geometric calculations. Each program prompts the user for input, processes the data, and prints the results, including operations like sum, difference, product, division, and calculations for area and perimeter of rectangles and squares. It serves as a simple guide for beginners to understand input handling and basic mathematical operations in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PYTHON PROGRAMS

1. WAP to input two Nos. & print their Sum.


A=int(input('Enter a No. '))
B=int(input('Enter a No. '))
C=A+B
print('Sum is ',C)

2. WAP to input two Nos. & print their Difference.


A=int(input('Enter a No. '))
B=int(input('Enter a No. '))
C=A-B
print('Difference is ',C)

3. WAP to input three Nos. & print their product.


A=int(input('Enter a No. '))
B=int(input('Enter a No. '))
C=int(input('Enter a No. '))
D=A*B*C
print('Product is ',D)

4. WAP to input two Nos. & print their +,-,*,/.


A=int(input('Enter a No. '))
B=int(input('Enter a No. '))
C=A+B
D=A-B
E=A*B
F=A/B
print('Sum is ',C)
print('Difference is ',D)
print('Product is ',E)
print('Division is ',F)

5. WAP to input a No. & print its double, cube, square and half.
A=int(input('Enter a No. '))
C=A*2
D=A*A*A
E=A*A
F=A/2
print('Double is ',C)
print('Cube is ',D)
print('Square is ',E)
print('Half is ',F)

6. WAP to input the sides of a Rectangle & print its Area and perimeter.
L=int(input('Enter Length of a Rectangle '))
B=int(input('Enter Breadth of a Rectangle '))
A=L*B
P=2*(L+B)
print('Area is ',A)
print('Perimeter is ',P)

7. WAP to input the side of a Square & print its Area and perimeter.
S=int(input('Enter Length of a Rectangle '))
A=S*S
P=4*S
print('Area is ',A)
print('Perimeter is ',P)

You might also like