Answer to Question #53467 in C for rajashree g.s.

Question #53467
#include<stdio.h>
int main()
{
int x=3,y=5;
if(x==3)
printf("\n %d",x);
else;
printf("\n %d",y);
return 0;
}
what is the logic behind this program sir.can you please explain me clearly.
1
Expert's answer
2015-07-20T01:29:10-0400
Condition
what is the logic behind this program sir.can you please explain me clearly.
#include
int main()
{
int x=3,y=5;
if(x==3)
printf("\n %d",x);
else
printf("\n %d",y);
return 0;
}
Solution
You are declaring the x and y variables with values 3 for x and 5 for y. Later you have two “ways”. If variable x equals 3 - program will print x variable to the console and you will see number 3. If variable x have any another values (not equals 3) - program will print y variable to the console and you will see number 5.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS