practice_C

For and Do-While Loops

Exercises

  1. Print 1 to n using a for loop.
  2. Print all factors of a number using a for loop.
  3. Check whether a number is perfect using a for loop.
  4. Print odd numbers from 1 to n using a do...while loop.
  5. Print the reverse of an integer using a do...while loop.

Click here for explanation and solution.