TASK:
- In a school sports event, all students wearing ODD jersey numbers enter the ground first. After they finish, students with EVEN jersey numbers enter. Display the order.
PROGRAM:
- ODD JERSEY PROGRAM:
no=1
while (no<=10):
print(no, end=' ')
no=no+2
output:
1,3,5,7,9
- EVEN JERSEY PROGRAM:
no=2
while(no<=10):
print(no, end=' ')
no=no+2
- COMBINING TWO PROGRAM INTO A SINGLE PROGRAM:
(i) FLOWCHART:
(ii) PROGRAM:
no=1
while(no<=10):
print (no, end=' ')
no=no+2
if(no==11):
no=2
output:
1,3,5,7,9,2,4,6,8,10
- A daughter is going on a 5-day vacation. She asks her father to give her ₹5 every day, so she can save the money.
Her father suggests a different plan. Instead of giving her ₹5 daily, he says:
Day 1: ₹1
Day 2: ₹2
Day 3: ₹3
Day 4: ₹4
Day 5: ₹5
The daughter agrees to her father's proposal.
Write a program to calculate:
A) The total amount the daughter would receive under her original plan.
B) The total amount she would receive under her father's plan.
C) Display both totals.
Redo the same activity for 10 days leave, instead of 5 days.
PROGRAM:
A) Daughter plan:
box=0
day=1
while day<=5:
box=box+5
day=day+1
print(box)
output:
25
B) Father plan:
box=0
day=1
while day<=5:
box=box+day
day=day+1
print(box)
output:
15
C) Display the both total for 10 days instead of 5 days
box=0
day=1
while day<=10:
box=box+10
day=day+1
print(box)
output:
100
box=0
day=1
while day<=10:
box=box+day
day=day+1
print(box)
output:
55

Top comments (0)