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.
8. Write a python program to find sum of all odd numbers between 1 to n.
zo
9. Write a python program to print multiplication table of any number.
y
ud
10. Write a python program to count number of digits in a number.
t
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
14. Write a python program to calculate sum of digits of a number.
15. Write a python program to calculate product of digits of a number.
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.
19. Write a python program to enter a number and print it in words.
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
27. Write a python program to print all Prime numbers between 1 to n.
y
28. Write a python program to find sum of all prime numbers between 1 to n.
ud
29. Write a python program to find all prime factors of a number.
t
.s
30. Write a python program to check whether a number is Armstrong number or not.
w
31. Write a python program to print all Armstrong numbers between 1 to n.
w
32. Write a python program to check whether a number is Perfect number or not.
w
33. Write a python program to print all Perfect numbers between 1 to n.
34. Write a python program to check whether a number is Strong number or not.
35. Write a python program to print all Strong numbers between 1 to n.
36. Write a python program to print Fibonacci series up to n terms.
37. Write a python program to find one's complement of a binary number.
38. Write a python program to find two's complement of a binary number.
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.
44. Write a python program to convert Octal to Hexadecimal number system.
ne
45. Write a python program to convert Decimal to Binary number system.
zo
46. Write a python program to convert Decimal to Octal number system.
y
ud
47. Write a python program to convert Decimal to Hexadecimal number system.
48. Write a python program to convert Hexadecimal to Binary number system.
t
.s
49. Write a python program to convert Hexadecimal to Octal number system.
w
50. Write a python program to convert Hexadecimal to Decimal number system.
w
w