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 context in c?
What are the general description for loop statement and available loop types in c?
List some basic data types in c?
Can you write the function prototype, definition and mention the other requirements.
How is a structure member accessed?
how many header file is in C language ?
44 Answers College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,
how to compare two strings without using strcmp() function??
What is the use of structure padding in c?
What are reserved words?
N O S I E R + A S T R A L ---------------- 7 2 5 6 1 3
Explain the difference between structs and unions in c?
why ordinary variable store the later value not the initial