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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why isn't any of this standardized in c? Any real program has to do some of these things.

621


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

639


What does double pointer mean in c?

573


What is difference between array and structure in c?

573


Write a code to determine the total number of stops an elevator would take to serve N number of people.

725






What is a void pointer? When is a void pointer used?

618


Can stdout be forced to print somewhere other than the screen?

616


Explain built-in function?

587


What is gets() function?

666


Are there constructors in c?

588


How can I recover the file name given an open stream or file descriptor?

589


Explain how do you generate random numbers in c?

618


Is main is a keyword in c?

602


Why c language?

642


What does int main () mean?

543