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 |
Explain which function in c can be used to append a string to another string?
What is the difference between declaring a variable and defining a variable?
What are the advantages of c language?
Why is sizeof () an operator and not a function?
What is encapsulation?
how to sort two array of characters and make a new array of characters.
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
#include main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }
What is an identifier?
What is the function of multilevel pointer in c?
Find the middle node in the linked list?? (Note:Do not use for loop, count and count/2)
What does %p mean?