C Program to Print 1-10 numbers without using Conditional Loops


Print 1-10 numbers without using Conditional Loop i.e without using

  • for Loop
  • while Loop
  • do-while Loop

This can be achieved in 3 ways :

  1. Using Printf Statement 10 Times.
  2. Using Recursive Function
  3. Using goto Statement.
  4. Recursive Main Function

Way 1 : Printf Statement 10 times

  • Use 10 Times Printf Statement .

Way 2 : Recursive Function

  • Recursive function : Calling Itself .
  • printNumber function calls itself so it is called Recursive function .

Way 3 : Using Goto Statement

Way 4 : Using Recursive Main

  • Static variable inside a function means “once the variable has been initialized, it remains in memory until the end of the program”