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



what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; ..

Answer / varun

the value of y is not changing so i think y wll reamin 5.

Is This Answer Correct ?    18 Yes 1 No

what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; ..

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

what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; ..

Answer / rahul

8

Is This Answer Correct ?    8 Yes 7 No

what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; ..

Answer / vint

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

Post New Answer

More C Interview Questions

what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }

4 Answers  


Is calloc better than malloc?

0 Answers  


What is an operator?

0 Answers  


What are structures and unions? State differencves between them.

0 Answers   iNautix,


What is 02d in c?

0 Answers  






What do you know about the use of bit field?

0 Answers  


What are the different types of control structures?

0 Answers  


How can I set an array's size at run time?

9 Answers  


What is static function in c?

0 Answers  


How can you find out how much memory is available?

0 Answers  


program to find the roots of a quardratic equation

1 Answers  


What is the need of structure in c?

0 Answers  


Categories