C Program to print your name 10 times without using while loop, for loop or goto statement

Ex: Write a C Program to print your name 10 times without using loops or goto statement using recursion function. How to write a C Program to print your name 10 times without using loops or goto statement using recursion function. C Program to print your name 10 times without using loops or goto statement using recursion function.


In below program we have used recursion function to print name 10 times.

What is recursion function?
Recursion function means function calling it self ...In simple words recursion() means call a function inside the same function then it is called as recursive call of the function.




  C Program to print your name 10 times without using while loop, for loop or goto statement:


#include<stdio.h>
void rec(int i)
{
if(i<=10)
{
printf("%02d omkar\n",i);
rec(i+1);
}
}
int main()
{
int i=1;
rec(i);
}


Above Program show's the following output:


C Program to print your name 10 times without using while loop, for loop or goto statement



2 comments:

  1. you are actually using loop in this program man.

    ReplyDelete
    Replies
    1. Yes, but we are not using C loops concepts like for loop, while loop or do while loop. Here we are using recursion() function to repeat the statement.
      Visit our more C Programming articles :)

      Delete

If you have any doubts, please discuss here...👇