Assignment 03
Loops
1. Write a program to print the number
numbers from 1 to 10 using a for loop.
2. Implement a program to calculate the sum of numbers from 1 to 100 using a while loop.
3. Create a program to print the multiplication table for a given number using a for loop.
4. Write a program to find the factorial of a number using a do-while loop.
5. Implement a program to calculate the average of 5 numbers using a for loop.
6. Create a program to print the Fibonacci series up to 10 terms using a for loop.
7. Write a program to check if a number is prime using a for loop.
8. Implement a program to print the reverse of a number using a while loop.
9. Create a program to generate and print the first 10 square numbers using a do do-while
while loop.
10. Write a program to find the GCD of two numbers using a for loop.
11. Implementt a program to print the even numbers from 2 to 20 using a while loop.
12. Create a program to calculate the sum of even numbers from 1 to 50 using a for loop.
13. Write a program to check if a given string is a palindrome using a for loop.
14. Implement a program to calculate the square root of a number using a do do-while loop.
15. Create a program to print the prime numbers between 1 and 50 using a for loop.
16.. Create a program to print the ASCII values of all uppercase letters using a do
do-while
while loop.
17.. Write a program to print the pattern: 1, 22, 333, 4444, 55555 using nested for loops.
18. Implement a program to calculate the factorial of a number using a for loop.
19.. Create a program to check if a number is a palindrome using a while loop.
20.. Write a program to print the sum of odd numbers from 1 to 50 using a for loop.
21. Implement a program to find the square
quare of numbers from 1 to 10 using a while loop.
22.. Write a program to find the sum of digits of a number using a do do-while loop.
23.. Create a program to print the numbers in reverse order from 10 to 1 using a while loop.
24. Implement a program
gram to print the pattern: 1, 2, 4, 8, 16 using a while loop.
25.. Write a program to find the smallest digit in a number using a for loop.
26.. Create a program to print the multiplication table for a given number using a while loop.
27.. Write a program to check if a number is a perfect square using a for loop.
28.. Implement a program to calculate the cube of numbers from 1 to 5 using a for loop.
29.. Create a program to check if a given number is a multiple of 4 using a dodo-while loop.
30.. Implement a program to print the pattern: 1, 1, 2, 3, 5, 8 using a for loop.
31.. Implement a program to print the reverse of a string using a do do-while loop.
32.. Create a program to calculate the average of odd numbers from 1 to 50 using a while loop.
33.. Write a program to print the pattern: 1, 4, 9, 16, 25 using a for loop.
34.. Create a program to print the pattern: 1, 3, 5, 7, 9 using a for loop.
35. Implement
ement a program to print the pattern: A, BB, CCC, DDDD using nested for loops.
36.. Write a program to check if a given number is a palindrome usi using nested while loops.