1.

Write a recursive function that has one parameter which is an integer value called x. The function prints x asterisks followed by x exclamation points. Do not use any loops. Do not use any variables other than x.

Answer»

The recursive function printast () for the required task is as follows:- 

void printast (int a) 

{

if (a > 0)

{

printf ("*");

a--;

printast (a); 

}

if (a!=0)

printf ("!");

}



Discussion

No Comment Found

Related InterviewSolutions