0% found this document useful (0 votes)
91 views3 pages

Class-5 Computer Prog

computer

Uploaded by

SUKESH DEBBARMA
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)
91 views3 pages

Class-5 Computer Prog

computer

Uploaded by

SUKESH DEBBARMA
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/ 3

SAMPLE PYTHON PROGRAMS

CLASS – 5
**NOTE: - SIMILAR TYPE OF PROGRAMS WILL COME IN EXAM, NOT EXACTLY THE SAME**
1.WAP to print the sum of two numbers 50, 30.
#numbers
a=50
b=30
s=a+b
print (s)

2. WAP to print the sum and average of three numbers 30, 40, 50.
#numbers
a=30
b=40
c=50
s=a+b+c
av=s//3
print (s)
print (av)

3. WAP to print the product of two numbers 5, 7.


#numbers
a=5
b=7
p=a*b
print (p)

4. WAP to print the quotient and remainder of two numbers 9 and 4.


#numbers
a=9
b=4
q=a//b
r=a%b
print (q)
print (r)

5. WAP to print the area and perimeter of a rectangle of length 12cm and breadth 7cm.
#numbers
l=12
b=7
p=2*(l+b)
a=l*b
print (p)
print (a)

6. WAP to print the perimeter of triangle whose sides are 7cm, 5cm, 3cm.
#numbers
a=7
b=5
c=3
p=a+b+c
print (p)
7. WAP to print the area and perimeter of a square whose side is 5cm.
#numbers
s=5
p=4*s
a=s*s
print (p)
print (a)

8. WAP to print the simple interest and total amount of principal amount Rs.5000, time 3 years and rate of interest
10%.
#simple_interest
P=5000
t=3
r=10
si=(p*t*r)//100
ta=p+si
print (si)
print (ta)

9. WAP to convert 5kg 250g, 10kg 150g, 9kg 125g to gram and print their sum.
#convert
a = (5*1000)+250
b = (10*1000)+150
c = (9x1000)+125
s=a+b+c
print (s)

10. WAP to print the cost of one apple when the cost of 5 apple is Rs.80.
#wordproblem
a=80
b=5
c=a//b
print (c)

11. WAP to print the cost of 8 mangoes when the cost of one mango is Rs.12.
a=12
b=8
c=a*b
print(c)

12. WAP to print the square of the numbers 5, 6.


a=5
b=6
print (a**2)
print (b**2)

13. WAP to print 10 % of Rs. 200.


#percentage
a = 200
b = 10
p = 10/100 * 200
print (p)
NOTE:- THIS ARE SAMPLE OUTPUTS FOR PRACTICE, SIMILAR TYPE OF OUTPUTS WILL COME IN EXAM
Find the output with proper steps
1) WORKING 2) WORKING 3) WORKING
a = 10 p=(a+b)*2 x=7 z=(x-y)//2 a = 15 c=(a//)*2
b=3 = (10 + 3) * 2 y=3 = (7-3)//2 b=5 = (15//5)*2
p = (a + b) * 2 = 13 * 2 z = (x - y) // 2 = 4 // 2 c = (a // b) * 2 = 3 *2
print (p) = 26 print (z) =2 print (c) =6
output = 26 output = 2 output = 6

4) WORKING 5) WORKING
a = 10 p = (a * b) // 5 x = 35 z = (x // y) + z
b=3 = (10 * 3) // 5 y=7 = (35 // 7) + 2
p = (a * b) // 5 = 30 // 5 z = (x // y) + 2 =5+2
print (p ** 2) =6 print (z * y) =7
print (6 ** 2) print (z * y)
= 6 x 6 = 36 = 7 * 7 = 49
Output = 36 output = 49

You might also like