1.
#include<stdio.h>
void main()
{
printf("%d%d%d\n",50,100);
}
2.
void main(){
a=3.5;
printf("%d",a);
}
3.
void main(){
printf(%d%d",100,200,300);
}
4.
void main(){
printf(2+3=%d",2+3);
}
5.
void main(){
int a;
a=3+5*5+3;
printf(%d,a);
}
6.
void main(){
int a;
a=printf("sumit%d",printf("sumit));
printf("%d",a);
}
7.
void main(){
printf("%d",%d",47%5,47%-5);
printf("%d%d%d",-47%5,-47%-5,5%7);
}
8.
void main(){
int a;
float f;
a=12/5;
f=12/5;
printf("%d%f",a,f);
}
9.
void main(){
int a,b;
a=b=100;
scanf("%d%d",a,&b);
//enterde value are 40,85
printf("%d%d",a,b);
}
10.
void main(){
int a;
if(a=15)
printf("welcome%d",a);
else
printf("Hello %d",a);
}
11.
void main(){
printf("%d",10?0?20?35:45:55:65);
}
12.void main(){
int a,b;
a=15;b=25;
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
}
13.
void main(){
printf("%d",-2&&2);
}
14.
void main()
{
if(!10>-10)
printf("C");
else
printf("C++");
}
15.
void main()
{
int a=80;
if(a++>80)
printf("Welcome %d",a);
else
printf("hello %d",a);
}
16.
void main()
{
printf("One");
if(2>1)
printf(Two");
else
printf("Three");
printf("Four");
}
17.
void main()
{
float a;
a=6.7;
if(a==6.7)
printf("A");
else
printf("B");
}
18.
void main()
{
int a;
a=1;
while(a-->=1)
while(a-->=0);
printf("%d",a);
}
19.
void main()
{
int a;
a=++100;
printf("%d",a);
}
20.
void main()
{
int a;
a=10;
a*=10+2;
printf("%d",a);
}
21.
void main()
{
int a;
a=100;
printf("%d%d",++a,a++);
}
22.
void main()
{
int a;
a=100>90>80;
printf("%d",a);
}
23.
void main()
{
int a;
a=10;
while(a++<=15)
printf("%d",a);
printf("%d",a+10);
}
24.
void main()
{
int a,b;
a=b=10;
while(a)
{
a=b++<=13;
printf("%d%d",a,b);
}
printf("%d%d\n",a+10,b+10);
}
25.
void main()
{
int a;
a=1;
a++*++a;
printf("%d",a);
}
26.
void main()
{
int a,b;
a=b=1;
a=a++ + ++b;
b=b++ + ++a;
printf("%d%d",a,b);
}
27.
void main()
{
int a=1,b;
b=++ ++a;
printf("%d%d",a,b);
}
28.
void main()
{
int a=1;
while(a++<=1)
while(a++<=2);
printf("%d",a);
}
29.
void main()
{
int a;
a=1;
while(a<=1)
if(a%2)
printf("%d",a++);
else
printf("%d",++a);
printf("%d",a+10);
}
30.
void main()
{
int a=10;
printf("%d",a);
{
int a=20;
printf("%d",a);
}
printf("%d",a);
}
31.
void main()
{
int a;
a=10;
do
while(a++<10)
while(a++<=11);
printf("%d",a);
}
32.
void main()
{
int a,b;
for(a=b=10;a;printf("\n%d%d",a,b))
a=b++<=12;
printf("\n%d%d",a+10,b+10);
}
33.
void main()
{
int a;
a='a'>'A';
printf("%d",a);
}
34.
void main()
{
printf("%d%d",sizeof(10),sizeof(5.5));
}
35.
void main()
{
int i;
long int l;
float f;
i=32767+1;
l=32767+1;
f=32767+1;
printf("%d%ld%f",i,l,f);
}
36.
void main()
{
int i;
for(i=1;i++<=1;i++)
i++;
printf("%d",i);
}
37.
void main()
{
int i;
for(i=1;i++<=1;i++)
for(i++;i++<=6;i++)
i++;
printf("%d",i);
}
38.
void main()
{
printf("1");
goto XYZ;
printf("2");
XYZ:
printf("3");
}
39.
void main()
{
int a=2;
switch(a)
{
case 1:printf("A");
case 2:printf("B");
case 3:printf("C");
break;
case 4:printf("D");
default:printf("E");
break;
}
}
40.
void main()
{
int a=2;
switch(a)
{
case 1:printf("A");
case 2:printf("B");
case 3:printf("C");break;
case 4:printf("D");
default:printf("E");break;
}
}
41.
void main()
{
int a=2;
switch(a)
{
case 1:printf("A");
break;
case 2:printf("B");
continue;
case 3:printf("C");
break;
case 4:printf("D");
default:printf("E");
}
}
42.
void main()
{
int a=2;
switch(a)
{
case 4:printf("A");
break;
case 3:printf("B");
case 2:printf("C");
case 1:printf("D");
break;
default:printf("E");
}
}
43.
void main()
{
int a=2;
switch(a)
{
case 4:printf("A");
break;
case 3:printf("B");
case default:printf("C");
case 1:printf("D");
break;
case 5:printf("E");
}
}
44.
void main()
{
int a,b,c,d;
a=b=c=d=1;
a=++b>1||++c?1&&++d>1;
printf("%d%d%d%d",a,b,c,d);
}
45.
void main()
{
int a;
a=1;
while(a<=10)
{
printf("%d",a);
if(a>3)
break;
a++;
}
printf("%d",a+10);
}
46.
void main()
{
int a;
a=1;
while(a<=10)
{
printf("%d",a);
if(a>3&&a<8)
continue;
a++;
}
printf("%d",a+10);
}
47.
void main()
{
int a=-1;
printf("%d%u%o%x",a,a,a,a);
}
48.
void main()
{
int a=100;
printf("%d%u%o%x",a,a,a,a);
}
49.
void main()
{
printf("%d%d%d",10<<1,10>>1,~10);
printf("%d%d%d",10^20,10|20,10&20);
}
50.
void main()
{
int a=1;
a=a<<15;
printf("%d",a);
}
51.
void main()
{
int a;
a=453<<16;
printf("%d",a);
}
52.
void main()
{
int a;
a=453>>16;
printf("%d",a);
}
53.
void main()
{
int a;
a=~0;
printf("%d",a);
}
54.
void main()
{
printf("%d%d%d",-10^9,-10|9,-10&9);
}
55.
void main()
{
int x=10,y=20;
while(x++<=12||y++<=22)
printf("\n%d%d",x,y);
printf("%d%d",x+10,y+10);
}
56.
void main()
{
float a;
a=8.5;
if(a==8.5)
printf("1");
else
printf("2");
}
57.
void main()
{
int a;
a=-1;
while(a--);
printf("%d",a);
}
58.
void main()
{
int i;
i=1;
i=i+2*i++;
printf("%d",i);
}
59.
main()
{
int i=10;
printf("%d%d%d",++i,i++,++i);
}
60.
void main()
{
int a=10,b=20;
a>=5?b=100:b=200;
printf("%d",b);
}
61.
void main()
{
int x=10,y=20;
if(!(!x)&&x)
{
printf("x=%d",x);
}
else
{
printf("y=%d",y);
}
}
62.
void main()
{
int x,y,z;
x=y=z=1;
z=++x||++y&&z;
printf("%d%d%d",x,y,z);
}
63.
void main()
{
int i=3;
float f=3.0;
if(i==f)
printf("\n both are equal");
else
printf("\n not equal");
}
64.
void main()
{
int x=4,y,z;
y=-x;
z=x--;
printf("%d%d%d",x,y,z);
}
65.
void main()
{
int i=1,j;
j=i++&&i++;
printf("%d%d",i,j);
}
66.
void main()
{
int i=-3,j=2,k=0,m;
m=++i&&++j||++k;
printf("%d%d%d%d",i,j,k,m);
}
67.
void main()
{
int i=-3,j=2,k=0,m;
m=++i&&++j&&++k;
printf("%d%d%d%d",i,j,k,m);
}
68.
void main()
{
int i=60;
printf("%d%d%d",i<=60,i=20,i>=10);
}
69.
void main()
{
int a=23,b=4,c;
c=a!=4||y==2;
printf("c=%d",c);
}
70.
void main()
{
float a=6.5;
printf("%d",a);
}
71.
void main()
{
int x,y;
x=7,y=0;
if(x=6)
y=7;
else
y=1;
printf("%d%d",x,y);
}
72.
int main()
{
int i;
for(;scanf("%d",&i;printf("%d",i))
return 0;
}
73.
int main()
{
printf("%x",-1<<3);
return 0;
}
74.
void main()
{
unsigned int res;
res=(64>>(2+1-2))&(~(1<<2));
printf("%d",res);
}
75.
void main()
{
printf("%d%d",32>>1,32>>0);
printf("%d%d",32<<-1,32<<0);
printf("%d%d",32>>1,32<<-0);
printf("%d%d",32>>-1,32>>-0);
}
76.
void main()
{
int i=0;
switch(printf("k"),printf("ku"))
{
case 1:printf("%d",i);
break;
case 2: printf("%d",++i);
break;
}
}
77.
void main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
{
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default:i+=4;
break;
}
}
printf("%d",i);
}
78.
How many time the loop will get executed?
int i;
for(i=0;i=10;i++)
printf("Hi");
79.
int n=1,sum=1;
switch(n)
{
case 1:sum+=2;
case 2:sum*=2;
break;
default:sum=0;
}
what is the value of sum?
80.
which of the following is invalid
a)a+=b b)a*=b c)a>>=b d)a**=b
81)
int main()
{
double f=2.25;
printf("%e",f);
printf("%f",f);
printf("%g",f);
}
82)
main()
{
if(-1)
printf("hello");
else
printf("bye");
}
83)
main()
{
if(23);
printf("hello");
else
printf("bye");
}
84)
main()
{
if(23)
printf("hello");
else;
printf("bye");
}
85)
main()
{
int a='b';
switch(a)
{
case 'a':
printf("a");
break;
case 'b':
printf("b");
}
}
86)
main()
{
char a='b';
switch(a)
{
case 'a':
printf("a");
break;
case 'b':
printf("b");
}
}
87)
main()
{
if(printf("%c",59)){}
}
88)
main()
{
while(printf("%c",65))
{
}
}
89)
main()
{
while("hai");
printf("hello");
}
90)
main()
{
while()
printf("hello");
}
91)
main()
{
int a=9;
switch(a)
{
case 9:
printf("hai");
case 011:
printf("bye");
}
}
92)
main()
{
if("true")
printf("true");
else
printf("false");
}
93)
main()
{
if(false")
printf("true");
else
printf("false");
}
94)
main()
{
if(0xcafebabe)
printf("true");
else
printf("false");
}
95)
main()
{
int i=0;
for(;i;)
printf("\n for loop");
printf("\n end");
}
96)
main()
{
for(;0;)
printf("\n for loop");
printf("\n end");
}
97)
main()
{
while(0)
printf("\n while loop");
printf("\n end");
}
printf("1");
printf("%d",i);
void main()
{
}
Thanks. I was busy in the past month. I will try to update it frequently. Just be subscribed to it
ReplyDelete