Java Looping Programs
Java Looping Programs
Factorial of a number
5 = 5 x 4 x 3 x 2 x 1 = 120
2. Printing table of a number
3
3 x 1 = 3
3 x 2 = 6
.......
3. Finding HCF
4. Finding LCM
5. Converting Decimal to Binary
14 = 1110
6. Converting Binary to Decimal
1110 = 14
7. Checking whether the number is Niven or not.
126%(1+2+6) ==0
8. Checking whether the number is Neon or not.
9
sqaure of 9 = 81
8 + 1 = 9
9. Checking whether the number is Palindrome or not.
121, 1331, 525, 626, 111, .............
10. Checking whether the number is Armstrong or not.
1, 153 , 407 ,..................
1 -> Cube of 1 = 1
153 -> Cube of 1 + cube of 5 + Cube of 3
1 + 125 + 27 = 153
407 -> Cube of 4 + cube of 0 + Cube of 7
64 + 0 + 343 = 407