Sir,please help me out with the output of this programme:-

#include<stdio.h>
#include<conio.h>
void main()
{
int a=18,b=12,i;
for(i=a<b?a:b;a%i||b%i;i--);
printf("%d %d",i);
}

Answer Posted / jaguar

Check how loop runs


At start of the loop for (I = 12; (18 % 12 || 12 % 12); i--)


1 ieteration &#61664; (6 || 0) and i = 11
1 ieteration &#61664; (7 || 1) and i = 10
1 ieteration &#61664; (0 || 3) and i = 9
1 ieteration &#61664; ( 2|| 4) and i = 8
1 ieteration &#61664; (4 || 5) and i = 7
1 ieteration &#61664; (0 || 0) and i = 6 Loop comes out then the
value of I prited is 6

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

661


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

669


What are global variables and explain how do you declare them?

569


What is an identifier?

618


Here is a neat trick for checking whether two strings are equal

562






Who developed c language and when?

575


What is variables in c?

602


Dont ansi function prototypes render lint obsolete?

601


What is ## preprocessor operator in c?

609


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1781


What are types of preprocessor in c?

613


What is strcpy() function?

652


What does static variable mean in c?

646


Why c is procedure oriented?

566


Lists the benefits of c programming language?

592