0% found this document useful (0 votes)
4 views4 pages

Program list-CLASS10

The document contains a list of programming tasks, each with a specific objective such as calculating simple interest, area and perimeter of a rectangle, performing arithmetic operations, computing roots of a quadratic equation, calculating discounts, and summing numbers based on certain criteria. Each task includes a code snippet in Python, along with example inputs and outputs. The tasks cover basic programming concepts and operations, making it a comprehensive guide for beginners.

Uploaded by

hpheeralal011984
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Program list-CLASS10

The document contains a list of programming tasks, each with a specific objective such as calculating simple interest, area and perimeter of a rectangle, performing arithmetic operations, computing roots of a quadratic equation, calculating discounts, and summing numbers based on certain criteria. Each task includes a code snippet in Python, along with example inputs and outputs. The tasks cover basic programming concepts and operations, making it a comprehensive guide for beginners.

Uploaded by

hpheeralal011984
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

List of programs

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'>

2. WAP to calculate Area and Perimeter of a rectangle


L=int(input("Length:")) OUTPUT:
B=int(input("Breadth:")) Length: 50
Area=L*B Breadth: 20
Area: 100
Perimeter=2*(L+B) Perimeter:140
print("Area:",Area)
print("Perimeter:",Perimeter)

3.WAP that reads two numbers and an arithmetic operator and display the result.

a=float(input("Enter first number:"))


b=float(input("Enter second number:"))
op=input("Enter operator[+ - * / %] : ") OUTPUT
result=0 Enter first number:67
if op=="+": Enter second number:34
result=a+b Enter operator[+ - * / %] : /
elif op=="-": 67.0 / 34.0 = 1.9705882352941178
result=a-b
elif op=="*":
result=a*b
elif op=="/":
result=a/b
elif op=="%":
result=a%b
else:
print("Invalid operator!")
print(a, op ,b, "=" ,result)
4.WAP to compute the roots of a quadratic equation
print(“Equation: ax^2 + bx + c “) OUTPUT:
a=int(input("Enter a: ")) Equation: ax^2 + bx + c
b=int(input("Enter b: ")) Enter a: 1
c=int(input("Enter c: ")) Enter b: -5
d=b**2-4*a*c Enter c: 6
d1=d**0.5 The first root: 3.0
if(d<0): The second root: 2.0
print("The roots are imaginary. ")
if(d>0): Equation: ax^2 + bx + c
r1=(-b+d1)/(2*a) Enter a: 1
r2=(-b-d1)/(2*a) Enter b: 5
print("The first root: ",r1) Enter c: 10
print("The second root: ",r2) The roots are imaginary.
if (d==0):
r1=-b/(2*a)
r2=-b/(2*a)
print (“roots are equal”)
print("The first root: ",r1)
print("The second root: ",r2)

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.6 A company decided to give bonus to employee according to following criteria:


Period of service Bonus
More than 10 years 10%
>=6 and <=10 8%
Less than 6 years 5%
Ask user for the salary and year of service and print the bonus amount
# to compute the bonus amount
salary=float(input("Enter the salary :"))
service= int(input("Enter the service in years : ")) output
if service >10 : Enter the salary : 55000
Enter the service in years : 7
Bonus amount : 4400.0
bonus=10/100*salary
if service >=6 and service <= 10 :
bonus=8/100*salary
if service < 6 :
bonus=10/100*salary
print ("Bonus amount :" ,bonus)

Qn.7 WAP to Print Multiplication Table of a given Number output:


Enter the number: 6
num = int(input("Enter the number: "))
Multiplication Table of 6
print("Multiplication Table of", num) 6X1=6
6 X 2 = 12
for i in range(1, 11): 6 X 3 = 18
6 X 4 = 24
print(num , "* ", i ,"=", num * i) 6 X 5 = 30
6 X 6 = 36
Qn.8. WAP to sum 6 X 7 = 42
. all the even numbers between 1 and 100 using for loop 6 X 8 = 48
. all the odd numbers between 1 and 100 using for loop 6 X 9 = 54
# sum all even numbers from 1 to 100 using a for loop 6 X 10 = 60
evensum=0
for i in range(2, 101, 2):
evensum=evensum +i
print(“sum of even numbers : ”, evensum)
# sum all odd numbers from 1 to 100 using a for loop
oddsum=0
for i in range(1, 101, 2):
oddsum=oddsum +i
print(“sum of odd numbers: ”, oddsum)
OUTPUT:
sum of even numbers : 2550
sum of odd numbers : 2500

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=”, “)

Output : Numbers divisible by 5 and 7 between 500 and 700


525, 560, 595, 630, 665,700,

You might also like