Solved Programs Practice Programs
#Program: To implement a mathematical calculator.
​
x=int(input("Enter a number"))
y=int(input("Enter another"))
print("The sum is ", x+y)
print("The difference is ", x-y)
print("The product is ", x*y)
print("The quotient is ", x/y)
print("The remainder of division is ", x%y)
print("The value of ", x,"raised to ",y, "is", x**y))
​
#Program: To print total and percentage
​
print("Maximum marks is 90")
MM=90
MCS=int(input("Marks of Computer Science- "))
ME=int(input("Marks of English- "))
MMA=int(input("Marks of Maths- "))
MP=int(input("Marks of Physics- "))
MC=int(input("Marks of Chemistry- "))
Percentage=((MCS+MMA+MC+MP+ME)/MM/5)*100
print("Percentage of Marks=",Percentage)
#Program: To print simple Interest
​
p=int(input("Enter principal(in rupees)="))
r=int(input("Enter rate(in percentage)="))
t=int(input("Enter time(in years)="))
a=(p*(1+(r/100))**t)
print("The Amount is=", a)
​
#Program: To print the area of a right angled triangle
​
b=int(input("enter base"))
h=int(input("enter height"))
print("area of right triangle is",b*h/2)
​
#Program: To print area of a triangle using heros formula.
print("area of a triangle")
x=int(input("enter the first side"))
y=int(input("enter the second side"))
z=int(input("enter the third side"))
s=((x+y+z)/2)
print("area is equal to")
import math
print(math.sqrt((s)*(s-x)*(s-y)*(s-z)))
​
​
​
1. WAP to input a temperature in Fahrenheit and convert it to Celsius and display.
​
2. WAP to input radius of a circle and calculate area and circumference.
​
3. WAP to input the cost price and profit to be obtained of an item. Calculate and display the selling price
​
4. WAP to input the height and base of a triangle and calculate its area.
Area=1/2 X base X height
​
5. WAP to input the length and breadth of a rectangle and calculate the area and circumference.
​
6. WAP to input the marks of a student in five subjects and calculate total marks and percentage.
​
7. WAP to input two numbers, p and q and find the result of p raised to the power q.
​
8. WAP to input a number and find its square root.
​
9. WAP to input the height of a person in inches and convert it to feet and inches.
​
10. WAP to input the distance between two places in meters and convert it into kilometers and meters.
​
11. WAP to input the height and radius of a sphere and find its surface area and volume.
​
12. WAP to to input the side of a cube and find its area and volume.
​
13. WAP to find the roots of a quadratic equation. Input the value of a, b and c.