Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
#WAP to implement mathematical calculator (add, subtract, multiply and divide two
#numbers)
a=float(input("Enter first number: "))
b=float(input("Enter second number: "))
sum= a+b
difference= a-b
product= a*b
quotient= a/b
print(sum)
print(difference)
print(product)
print(quotient)
Enter first number: 23
Enter second number: 15
38.0
8.0
345.0
1.5333333333333334
#wap to input length in meters and convert it into centimetres
a=int(input("Enter length in meters: "))
b= a*100
print (b)
Enter length in meters: 100
10000
#WAP to input length and breadth of a rectangle and find area and perimeter
a=float(input("Enter length in meters: "))
b=float(input("Enter breadth in meters: "))
Perimeter= 2*(a+b)
print(Perimeter)
Area= a*b
print(Area)
Enter length in meters: 12
Enter breadth in meters: 4
32.0
48.0
#WAP to input marks of a student in 3 subjects find total and percentage
#assuming maximum marks for each paper is 100
a=float(input("Enter marks in English: "))
b=float(input("Enter marks in Physics: "))
c=float(input("Enter marks in Biology: "))
Total= a+b+c
print(Total)
Percentage= (Total)/3
print(Percentage)
Enter marks in English: 23
Enter marks in Physics: 46
Enter marks in Biology: 78
147.0
49.0
#WAP to swap the value of two variables
a =float(input("Enter first number: "))
b = float(input("Enter second number: "))
z=a
a=b
b=z
print(a)
print(b)
Enter first number: 12
Enter second number: 21
21.0
12.0