c program tricky questions

c program interview tricky questions



1. point out the error in the program

#include <stdio.h>

void main()
{
int a=10,b=5,c=5;
float d;
d=a==(b+c);
print("%d",d);

}
output:-

error

answer:-

in this program print statement line wrong because  %d use for float 
%d use for int and %f use for float

2.point out the error in the program

#include <stdio.h>
void main()
{
int x=5.3%2;
print("value of x:- %d",x);

}

answer:-

the program give error because the modules operator never use with float value 






Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post