#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
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 |
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 |
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 |
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 |
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 |
What is union and structure?
Explain what are the different file extensions involved when programming in c?
Define function pointers?
what is the difference between 123 and 0123 in c?
Why do we use null pointer?
Write a program to check prime number in c programming?
What are the primitive data types in c?
What are comments and how do you insert it in a C program?
What is %g in c?
What is the return type of sizeof?
code for reverse alternate words from astring
What is a pointer on a pointer in c programming language?