Computer Project
Computer Project
1. INPUT
# output formation in given format
x=5
print(x)
print(x*2)
print((x*2)-1)
OUTPUT
5
10
9
2. INPUT
# input a number and print its 1st five multiples
x=int(input("enter any value : "))
a,b,c,d,e=x,x*2,x*3,x*4,x*5
print(a,b,c,d,e)
OUTPUT
enter any value : 5
the first five multiples are 5 10 15 20 25
3. INPUT
#A=P*(1+(n/r))**n*t
P=int(input("enter the principal amount : "))
n=int(input("enter the number of times intest applied : "))
t=int(input("enter the time period elapsed : "))
r=int(input("enter the intrest rate : "))
A=P*(1+(n/r))**n*t
S=(P*n*r)/100
print("the compound intrest and simple intrest : ", A,S)
OUTPUT
enter the principal amount : 10000
enter the number of times intest applied : 6
enter the time period elapsed : 12
enter the interest rate : 10
the compound intrest and simple intrest : 2013265.9200000009 6000.0
4. INPUT
#conversion of height from cm to inch to foot
x=int(input("enter your height in cm : "))
inch=2.54
foot=12
y=x/inch
print(“height in inches : ”,y)
z=y/foot
print(“height in feet : ”,z)
OUTPUT
enter your height in cm : 177
height in inches : 69.68503937007874
height in feet : 5.807086614173229
5. INPUT
#three number variable swap
x=int(input("enter a value for x : "))
y=int(input("enter a value for y : "))
z=int(input("enter a value for z : "))
x,y,z=x+y,y+z,z
print(x,y,z)
OUTPUT
enter a value for x : 16
enter a value for y : 17
enter a value for z : 18
33 35 18
6. INPUT
#find area of triangle
base=int(input("enter base :"))
height=int(input("enter height :"))
area=1/2*base*height
print(area)
OUTPUT
enter base :6
enter height :5
15.0
7. INPUT
#average of five subjects
maths=int(input("enter maths mark : "))
physics=int(input("enter physics mark : "))
english=int(input("enter english mark : "))
computer=int(input("enter computer mark : "))
chemistry=int(input("enter chemistry mark : "))
average=maths+physics+english+computer+chemistry/5
print(average)
OUTPUT
enter maths mark : 75
enter physics mark : 87
enter english mark : 67
enter computer mark : 82
enter chemistry mark : 78
326.6
8. INPUT
#area of the circle
pi=22/7
r=int(input("enter a radius"))
z=pi*r**2
print(z)
OUTPUT
enter a radius : 5
78.57142857142857
9. INPUT
# display how many days left
day = int(input("Enter day part of today's date: "))
totalDays = int(input("Enter total number of days in this month: "))
daysLeft = totalDays - day
print(daysLeft, "days are left in current month")
OUTPUT
Enter day part of today's date: 5
Enter total number of days in this month: 30
25 days are left in current month
10. INPUT
#input a number, n and display as <n(n + 1)(n + 2)>
d = int(input("Enter a digit in range 1-7: "))
n = d * 10 + d + 1
n = n * 10 + d + 2
print("3 digit number =", n)
OUTPUT
Enter a digit in range 1-7: 7
3 digit number = 789