do u print this format '(((())))'. This brackets is based on
user input like 4 or 5 or 6,without using any loop's?



do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,..

Answer / ashutosh tiwari

int r;
Void main()
{
scanf("%d",&r);
fun();
}

void fun()
{
static int t = r;
printf("(");
if(--t != 0)
fun();
printf(")");
}

OR

void main()
{
int r,i;
scanf("%d",&r);
i=r;
repeat1:
if(i != 0)
{
printf("(");
i--;
goto repeat1;
}
i=r;
repeat2:
if(i != 0)
{
printf(")");
i--;
goto repeat2;
}
}

Is This Answer Correct ?    11 Yes 2 No

Post New Answer

More C Interview Questions

Why C language is a procedural language?

0 Answers   Ericsson,


What are the different types of constants?

0 Answers  


What is Full Form of C and Why We use C

23 Answers  


Do you know what are bitwise shift operators in c programming?

0 Answers  


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1 Answers  






write a program to display the array elements in reverse order in c language

16 Answers  


Why is %d used in c?

0 Answers  


what is the full form of c language

9 Answers   Satyam, TCS, VNC,


How can I access an I o board directly?

0 Answers  


Can a file other than a .h file be included with #include?

0 Answers   Aspire, Infogain,


What is the use of function overloading in C?

0 Answers   Ittiam Systems,


What is a constant and types of constants in c?

0 Answers  


Categories