what is y value of the code if input x=10
y=5;
if (x==10)
else if(x==9)
elae y=8;
a.9
b.8
c.6
d.7
Answers were Sorted based on User's Feedback
Answer / varun
the value of y is not changing so i think y wll reamin 5.
| Is This Answer Correct ? | 18 Yes | 1 No |
Answer / prakash
I'm getting "error C2181: illegal else without matching if".
If that is corrected then the output will be y = 5.
| Is This Answer Correct ? | 5 Yes | 0 No |
int main()
{
int x = 10, y = 5;
if(x==10)
else if(x==9)
else y=8;
printf("%d",y);
return 0;
}
error: expected expression before 'else'
------------
int main()
{
int x = 10, y = 5;
if(x==10) {}
else if(x==9) {}
else {y=8;}
printf("%d",y);
return 0;
}
OP: 5
| Is This Answer Correct ? | 1 Yes | 0 No |
What is structure packing ?
What is local and global variable in c?
how to TOGGLE Nth bit of variable in a MACRO
What are conditional operators in C?
Is javascript based on c?
What is variables in c?
Which node is more powerful and can handle local information processing or graphics processing?
plz let me know how to become a telecom protocol tester. thank you.
write a c program to find largest of three numbers using simple if only for one time.
Why is c so powerful?
convert 12345 to 54321 withoutusing strig
How can you call a function, given its name as a string?