Exercise On C

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 10

Lalit Matoliya

Netcom (An Authorized Training Centre)


CDAC-ACTS

main()
{
int x , y , z;
x=3+4-7*8/5%10;
y=-3+4-7*8/5%10;
z=-3*-4%-6/-5;
printf(x=%d y=%d z=%d,x,y,z);
}
main()
{
float a=1.5;
int b=3;
a=b/2 + b*8/b-b+a/3;
printf(A=%f,a);
}

main()
{
int i=-4, j, num=10;
j=i%-3;
j=(j?0:num*num);
printf(J=%d,j);
}
main()
{
int x=10,y,z;
z=y=x;
y-=x--;
z-=--x;
x-=--x x--;
printf(y=%d z=%d x=%d,y,z,x);
}

main()
{
int x,y,z;
x=y=z=-1;
z=++x && ++y || ++z;
printf(x=%d y=%d z=%d\n,x,y,z);
}
main()
{
int i=32,j=65,k;
k=j^32;
printf(k=%d\n,k);
k=j<<2;
printf(k=%d\n,k);
k=i>>5;
printf(k=%d\n,k);
}

main()
{
float a,b;
int i,j;
a=(i=sizeof(i),j=sizeof(j), i+j);
printf(A=%d,a);
}
main()
{
int a=0xff;
(a<<4>>12)?printf(Hello): printf(Bye);
}

main()
{
int a=10;
(a&8==8)?printf(Hello):printf(Bye);
}

main()
{
int i;
for(i=0;i++<10;)
printf(%d,i);
}
main()
{
int i;
for(i=0;++i<=10;)
printf(%d,i);
}

main()
{

int i,j;
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
if(i==j)
continue;
else
printf(%d %d,i,j);
}
}
}

main()
{
int a=500 ,b=100,c;
if(!a>=400)
b=300;
c=200;
printf(b=%d c=%d ,b,c);
}
main()
{
float a=0.7;
if(a<0.7)
printf(Stoned);
else
printf(Avenged);
}

main()
{
int x=10, y=20;
if(!(!x) && x)
printf(x=%d,x);
else
printf(y=%d,y);
}
main()
{
float a=0.5 , b=0.9;
if(a&&b >0.9)
printf(Idleness is a virtue);
else
printf(.So is Stupidity);
}

main()
main()
{
{
int k=-2,j=4;
char ch=E;
switch(k/=j/k)
switch(ch)
{
{
case (ch>=65 && ch<=90):
default:
printf(Capital);
printf(All are same\n);
break;
case 0:
case (ch>=97 && ch<=122):
printf(Happy Birthday\n);
printf(Small);
break;
case 1:
case (ch>=48 && ch<=57):
printf(A punch on the mouth\n);
printf(Digit);
case 2:
break;
printf(A kick in the back\n);
default:
}
printf(Any other);
}
}
}

main()
{
char j=1;
while(j<=255)
{
printf(%d\n,j);
j=j+1;
}
}
main()
{
int a=1;
for(a=1;a<=32767;a++);
printf(%d,a);
}

main()
{
int i;
for(i=1;i++<=5;printf(%d,i));

}
main()
{
int i=1;
for(;i++;)
printf(%d,i);
}
main()
{
int a=5;
do
{
printf(%d\n,a);
a=-1;
}while(a>0);
}

main()
{
int sum;
printf(%d,sizeof(float));
printf(%d,sizeof(sum));
printf(%d,sizeof(234L));
printf(%d,sizeof(A));
}
main()
{
int x=49;
for(;x;)
x--;
printf(%d\n,x);
}

main()
{
int z, x=5,y=-10,a=4,b=2;
z=x++ - --y * b/a;
printf(z=%d,z);

}
main()
{
int sum, index;
float average;
sum=0;
for(;;)
{
sum=sum+index;
++index;
if(sum>=100)
break;
}
average=sum/index;
printf(Average=%f,average);
}

void main()
{
int a=7, b=5;
switch(a/a%b)
{
case 1:
a=a-b;
case 2:
a=a+b;
case 3:
a=a*b;
case 4:
a=a/b;
default:

a=a;
}
printf(A=%d,a);
}

void main()
{
int a[3][3] ={8,7,8,6,5,4,3,5};
printf(%d,(a*2+*0+>a*0+*0+?a*0+*2+:a*2+*2+);
}
void main()
{
int sum=1, count=-1;
do
{
count--;
sum=sum*3;
}while(count>5);
printf(Sum=%d,sum);
}
main()
{
int count=1, digit=0;
while(digit<=9)
{
printf(%d\n,++count);
++digit;
}
}

THANKS

You might also like