#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.
Comments
Leave a comment