Task 1
A teacher asks five students to stand in a line. Each student wears a badge with the number 1. Display the badge numbers from left to right.
Task 2
Five students enter the classroom one after another. The first student gets roll number 1, the second gets 2, and so on. Display the assigned roll numbers.
For loop:

While loop:

Output:

Task 3
A coach asks students to stand only at even-numbered positions in a queue. Display the first five positions.
For loop:

While loop:

Output:

Task 4
A newly constructed building has a special lift that does not stop on every floor. For safety reasons, it stops only at every third floor. A person enters the lift at the ground floor and presses the "Up" button.
Display the first five floors where the lift will stop.
For loop:

While loop:

Output:

Task 5
A rocket launches with a countdown using only even numbers. Display the countdown.
For loop:

While loop:

Output:




Top comments (1)
Excellent Effort