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

Posted by Tushar Bedekar
Print 1-10 numbers without using Conditional Loop i.e without using
  • for Loop
  • while Loop
  • do-while Loop


#include<stdio.h>

void printNumber(int value) {
   int i;
   printf("%d\n", value);          //The Following programme is written using the concept of recursion
   i = value + 1;

   if (i > 10)
      return;
   printNumber(i);
}

void main() {
   printNumber(1);
}

1 comment:

back to top