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
What are the advantage of c language?
What is c programming structure?
What 'lex' does?
What is a void pointer? When is a void pointer used?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
How many levels of pointers have?
Explain the difference between the local variable and global variable in c?
What is c token?
What are the general description for loop statement and available loop types in c?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What does %2f mean in c?
How do you search data in a data file using random access method?
Explain how can you tell whether a program was compiled using c versus c++?
What are register variables? What are the advantage of using register variables?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd