Type C Programming Practice Knowledge Based Questions Ip Pg 77,78
Type C Programming Practice Knowledge Based Questions Ip Pg 77,78
print("this is a joke")
print("Press enter")
a =input()
print("Happy Diwali")
2. Write a program to read today’s date (only del part from user. Then display how many days are left in the
current month.
a=5
print(a)
print(a*2)
print(a*2-1)
print(a,end="@")
print(a*2,end="@")
print(a*2-1)
OR
print(a,a*2,a*2-1,sep="@")
5. Write the program with maximum three lines of code that assigns first 5 multiples of a number to 5
variables and then print them.
num=int(input("Enter a number:"))
a,b,c,d,e=num*1,num*2,num*3,num*4,num*5
print(a,b,c,d,e)
6. Write a Python program that accepts radius of a circle and prints its area.
8. Write a short program that asks for your height in centimetres and then converts your height to feet and
inches.(1 foot = 12 inches, 1 inch =2.54 cm)
n=int(input("Enter a number:"))
n2=n**2
n3=n**3
n4=n**4
print("Number raise to the power 2 is:",n2)
print("Number raise to the power 3 is:",n3)
print("Number raise to the power 4 is:",n4)
#Area of Triangle
base=int(input("Enter the base of triangle:"))
height=int(input("Enter the height of triangle:"))
area= 1/2*(base*height)
print("Area of triangle is:",area)
si=(p*r*t)/100
ci= (p*(1+r/100)**t)-p
num=int(input("Enter a number:"))
print(num,"*","1","=",num*1,'\n',num,"*","2","=",num*2,'\n',num,"*","3","=",num*3,'\n',
num,"*","4","=",num*4,'\n',num,"*","5","=",num*5)
13. Write a program to read details like name, class, age of a student and then print the details firstly in same
line and then in separate lines. Make sure to have two blank lines in these two different types of prints.
14. Write a program to read three numbers in three variables and swap first two variables with the sums of
first and second , second and third numbers respectively.
15. Write a program to input the cost price, selling price and print the profit earned.
16. Write a program to input the total liabilities and shareholders’ equity of a company and print its D/E ratio as
Total liabilities / Total Shareholders’ Equity
18. Write a program that accepts cost of goods sold (cgos) revenue generated , operating codts(oc) and prints
Gross profit, net profit and net profit percentage.
Net profit= Revenue – cgos-oc
# Code