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

LOGIC OF Bodmas?

1 Answers  


Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


why should i select you?

21 Answers   Wipro,


writ a program to compare using strcmp VIVA and viva with its output.

0 Answers  


What’s a signal? Explain what do I use signals for?

0 Answers  


Differentiate abs() function from fabs() function.

0 Answers  


20. main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); } Answer:??????

2 Answers  


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

0 Answers  


what are enumerations in C

0 Answers   TCS,


Mention four important string handling functions in c languages .

0 Answers  


Difference between Shallow copy and Deep copy?

0 Answers  


to find the program of matrix multiplication using arrays

6 Answers   Bhel,


Categories