You are on page 1of 3

Find out the outputs of the following c

programs and explain the logic!


#include<stdio.h>
1. main()
{
Static int c=5;
printf(“c=%d\n”,c--);
if(c)
main();
}
#include<stdio.h>
2.main()
{
register int i;
for(i=1;i<=100;i++)
printf(“%d\n”,i);
}
3. #include<stdio.h>
main()
{
int x=10,y;
y=--x--;
printf(“x=%d\ny=%d”,x,y);
}
#include<stdio.h>
4.main()
{
Int x=10,y=x,z=x;
y-=x;
z=-x;
t=-x;
printf(“y=%d\nz=%d\nt=%d”,y,z,t);
}
5. #include<stdio.h>
main()
{
int a=10,b=10;
printf(“ans=%d”,a>b?a*a:b/b);
}

You might also like