List of Loop Programming Exercises
List of Loop Programming Exercises
1. Write a python program to print all natural numbers from 1 to n. - using while loop
m
2. Write a python program to print all natural numbers in reverse (from n to 1). - using
while loop
co
3. Write a python program to print all alphabets from a to z. - using while loop
a.
4. Write a python program to print all even numbers between 1 to 100. - using while loop
ity
5. Write a python program to print all odd number between 1 to 100.
ad
6. Write a python program to find sum of all natural numbers between 1 to n.
ne
7. Write a python program to find sum of all even numbers between 1 to n.
11. Write a python program to find first and last digit of a number.
.s
12. Write a python program to find sum of first and last digit of a number.
w
w
13. Write a python program to swap first and last digits of a number.
w
16. Write a python program to enter a number and print its reverse.
17. Write a python program to check whether a number is palindrome or not.
18. Write a python program to find frequency of each digit in a given integer.
20. Write a python program to print all ASCII character with their values.
m
21. Write a python program to find power of a number using for loop.
co
22. Write a python program to find all factors of a number.
a.
23. Write a python program to calculate factorial of a number.
ity
24. Write a python program to find HCF (GCD) of two numbers.
ad
25. Write a python program to find LCM of two numbers.
ne
26. Write a python program to check whether a number is Prime number or not.
zo
28. Write a python program to find sum of all prime numbers between 1 to n.
ud
30. Write a python program to check whether a number is Armstrong number or not.
w
32. Write a python program to check whether a number is Perfect number or not.
w
34. Write a python program to check whether a number is Strong number or not.
m
39. Write a python program to convert Binary to Octal number system.
co
40. Write a python program to convert Binary to Decimal number system.
a.
41. Write a python program to convert Binary to Hexadecimal number system.
ity
42. Write a python program to convert Octal to Binary number system.
ad
43. Write a python program to convert Octal to Decimal number system.