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 are lookup tables in c?
What is the size of structure in c?
difference between the array and linked list general difference related to memory
write a program in c to find out the sum of digits of a number.but here is a condition that compiler sums the value from left to right....not right to left..
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
What is d scanf?
How are Structure passing and returning implemented by the complier?
What are the 5 data types?
Is malloc memset faster than calloc?
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Tell us something about keyword 'auto'.