#include<stdio.h>
void main()
{
int a=5,b=6,c;
int x=(a<b)+7;
int y=(x==7)*9;
int z=(c=x+y)*2;
printf("%h %h %h",x,y,z);
}
What is the output? Explain it.

Answers were Sorted based on User's Feedback



#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / srinath

x=8;
y=0;
z=16;

Is This Answer Correct ?    19 Yes 6 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / seema choudhary

output:

x=8
y=0
z=16

x=8 because (a<b) condition is true, it return 1 means non
zero, then 1+7=8

y=0 because (x==7) condition is false return 0. then 0*9=0

z=16 because x=8,y=0 then 8+0=8*2=16

Is This Answer Correct ?    12 Yes 6 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / manohar

%h%h%h

Is This Answer Correct ?    9 Yes 3 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / arun sebastin

The answer is %h %h %h

Because to print integer in c we have to use %d

but here they use %h which is wrong and the printf

statement print it without any error

Is This Answer Correct ?    6 Yes 3 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / mohit (firozabad, adc)

Here The Program will be print the Message %h%h%h only
because in the c language
the data type print the integer value by %d
character by %c
float by %f
pointer type by %u

Is This Answer Correct ?    2 Yes 2 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / moolshankershukla

erreor generate because condition will not operate directly.
such as.

int x=(a<b)+7;
int y=(x==7)*9;

Is This Answer Correct ?    2 Yes 2 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / ashish tiwari

#include<stdio.h>
void main()
{
int a=5,b=6,c;
int x=(a<b)+7;
int y=(x==7)*9;
int z=(c=x+y)*2;
printf("%d %d %d",x,y,z);
getch();
}

this is a right programme which can give out put 8 0 16..

Is This Answer Correct ?    0 Yes 1 No

#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9;..

Answer / suresh mca

output
x=8
y=0
z=16

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

What is volatile c?

0 Answers  


main() { clrscr(); } clrscr();

6 Answers   ME, Wipro,


what will be maximum number of comparisons when number of elements are given?

0 Answers  


what are # pragma staments?

0 Answers  


When the macros gets expanded?

0 Answers  






What is a list in c?

0 Answers  


write a c program to find largest of three numbers using simple if only for one time.

1 Answers  


What is I ++ in c programming?

0 Answers  


we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?

2 Answers  


enum { SUNDAY, MONDAY, TUESDAY, }day; main() { day =20; printf("%d",); getch(); } what will be the output of the above program

1 Answers  


write a program to insert an element at the specified position in the given array in c language

5 Answers   Appin, IBM,


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

2 Answers   Cap Gemini, HCL,


Categories