program list-CLASS10
program list-CLASS10
1.WAP to compute Simple interest . Display the data type of the variables used in the
program
# to calculate the Simple Interest
p=float(input(“Enter the Principle amount”)
r = float(input(“Enter the rate of interest”)
t=float(input(“Enter the time in years”))
simple_interest = (p * r * t)/100
print("datatype of principle : ", type(p))
print("datatype of rate of interest : ", type(r))
print("value of simple interest : ", simple_interest)
print("datatype of simple interest : ", type(simple_interest))
OUTPUT
Enter the Principle amount :5000
Enter the rate of interest :8.5
Enter the time in years : 3
datatype of principle : <class 'float'>
datatype of rate of interest : <class 'float'>
value of simple interest : 1275.0
datatype of simple interest : <class 'float'>
3.WAP that reads two numbers and an arithmetic operator and display the result.
Qn.5 WAP to accept the marked price from the user and calculate the
net amount as (Marked_Price-Discount) to pay according to the following criteria
Marked _Price Discount
>10000 20%
>7000 and <= 10000 15%
<= 7000 10%
# to compute the net amount
netamount=0
discount =0
mprice= int(input(“Enter the marked price of the item: ”))
if mprice >10000 :
discount=20/100*mprice
OUTPUT
if mprice >7000 and mprice <= 10000 :
Enter the marked price of the item: 15875
discount=15/100*mprice
Discount amount : 3175.0
if mprice <=7000 :
Net amount : 12700.0
discount=10/100*mprice
netamount=mprice-discount
print (“ discount amount :” , discount )
print (“ Net amount :” , netamount)
Qn.9 WAP to calculate the sum of odd numbers divisible by 5 in the range 1..100
Source code:
# the sum of odd numbers divisible by 5 in the range 1..100
sum=0
for i in range(1, 1001,2):
if i % 5==0:
sum =sum + i
print(“Sum of odd numbers divisible by 5 between 1 and 100 : ”, sum)
output:
Sum of odd numbers divisible by 5 between 1 and 100 : 500
Qn 10: WAP to display the numbers which are divisible by 7 as well as 5 between
500 and 700
Source code:
# to display the numbers divisible by 5 and 7 between 500 and 700
print(“Numbers divisible by 5 and 7 between 500 and 700”)
for i in range(500, 700):
if i % 5==0 and i% 7 ==0 :
print(i ,end=”, “)