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 |
How can I swap two values without using a temporary?
What is difference between && and & in c?
how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--);
What is a lvalue
how to find out the inorder successor of a node in a tree??
what are bit fields in c?
how to find out the reverse number of a digit if it is input through the keyboard?
a=0; b=(a=0)?2:3; a) What will be the value of b? why b) If in 1st stmt a=0 is replaced by -1, b=? c) If in second stmt a=0 is replaced by -1, b=?
write a c program that prints all multiples of 3between 1 and 50.
swapping of two numbers without using third variable using AND and OR operators
A MobileNumber is a VIP number if it satisfy the following conditions. The operator should be Vodafone. Atleast one 0 (Zero) should be exist in mobile number. The number should not end with 8. The single digit sum of all the digits in the number should be equal to 9. For example if the number is 9876543210, the sum is 9+8+7+...+1+0 = 45. Sum of 4+5 = 9. Write a method: private boolean isVIPMobileNumber(String mobileNum, String operator) mobileNum phone number operator mobile operator as bsnl, Vodafone
why ordinary variable store the later value not the initial