These questions are designed to help students practice for loop, while loop, do-while loop, and nested loops.
1. Print numbers from 1 to 10 using a for loop.
2. Print even numbers from 1 to 50.
3. Print the table of 5 using a for loop.
4. Print all numbers from 10 to 1 (reverse order).
5. Calculate the sum of numbers from 1 to 100 using a loop.
6. Print the table of a number entered by the user.
7. Count how many numbers between 1 to 100 are divisible by 7.
8. Print all odd numbers from 1 to 50 using while loop.
9. Print the factorial of a number.
Example: 5! = 120
10. Print the Fibonacci series of first 10 terms.
(0, 1, 1, 2, 3, 5, 8, …)
11. Find the largest number in an array using a loop.
Example: [10, 50, 2, 9, 100]
12. Reverse an array using a loop.
Example: [1,2,3,4] → [4,3,2,1]
15. Print the sum of all elements in an array using a loop.
Example: [1,5,3,7] → 16
16. Count how many even and odd numbers are in an array.
17. Find the second largest number in an array using a loop.
13. Print this pattern using nested loops:
* ** *** **** *****
14. Print this number pyramid:
1 12 123 1234 12345
20. Print this star pattern (reverse triangle):
***** **** *** ** *
18. Print all prime numbers between 1 to 100.
19. Check if a number is palindrome using a loop.
Example: 121 → palindrome
📌 Practice all questions without using built-in functions.
Prepared By Ankit Sir | Dev Team