# Programming Questions on loops

## Problems on loops are one of the most often asked questions during Software Interviews and also exams.

• Write a program to  print all the Prime Numbers from 2 to 500. Your program should count the number of primes as well.
• Write a program to print all the Pythagorean Triplets between 1 to 100. Combinations like 32 + 42 = 52
• Write a program to check for palindromes among strings
• Write a program to print all permutations of a given number
• Write a program to find all prime factors of a number.
• Write a program to print the hexadecimal of a decimal number.
• Check for a Happy Number. A Happy is one whose sum of squares of digits ultimately reaches one.
Eg
19 = 12 + 92 = 1 + 81 = 82 = 82 + 22 = 64 + 4= 68 =  62 + 82 = 36 + 64 = 12 + 02 + 02 = 1 + 0 + 0=1
• Perfect number is a number that is equal to the sum of its proper divisors. 6 = 1 + 2 + 3.
• Armstrong number is equal to the sum of cubes of its digits.
Eg 371= 33 + 73 + 13 = 27 + 343 + 1= 371.