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
Answer Posted / 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 View All Answers
How can you return multiple values from a function?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
What is the size of structure pointer in c?
How many header files are in c?
What are the 4 types of organizational structures?
What is console in c language?
What is printf () in c?
What is the benefit of using const for declaring constants?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
What is return type in c?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
What are run-time errors?
What is const and volatile in c?
Is main is a keyword in c?
What is the difference between exit() and _exit() function?