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

Define C in your own Language.

0 Answers   Motorola,


What is the use of a semicolon (;) at the end of every program statement?

1 Answers  


What functions are used in dynamic memory allocation in c?

0 Answers  


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

0 Answers  


What's wrong with the call "fopen ("c:\newdir\file.dat", "r")"?

1 Answers  






i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

0 Answers   RBI,


i want to know aptitude questions,technical questions

2 Answers  


about c language

0 Answers  


ABCDCBA ABC CBA AB BA A A

4 Answers   TCS,


Write a c program for sum of first n terms of the series S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......

2 Answers  


What are runtime error?

0 Answers  


write a program to swap Two numbers without using temp variable.

75 Answers   EMC, Focus, GreyB, HCL, Hitech, HP, Huawei, Infosys, Mannar Company, Microsoft, Miles Software, Odessa Technologies, Satyam, TCS, Wipro,


Categories