For and Do-While Loops
Exercises
- Print 1 to
n using a for loop.
- Print all factors of a number using a
for loop.
- Check whether a number is perfect using a
for loop.
- Print odd numbers from 1 to
n using a do...while loop.
- Print the reverse of an integer using a
do...while loop.
Click here for explanation and solution.