Introduction To Programming

Why programs ? Programming is nothing but making the computers think the same way a human thinks. Programs are made for obtaining a specific solution which can even be solved by humans which when solved by us may consume time..

Sunday, August 15, 2010

Predict the output for this program

int main( )
{
printf("%d",printf("%d %d",5,5)&printf("%d %d",7,7));
return 0;
}

1 7 7 5 5
7 7 5 5 1
5 5 7 7 3
7 7 5 5 3

What is the output of the following program?

int main( )
{
printf(" %d %d",printf("%d %d",7,7),printf("%d %d",5,5));
return 0;
}


7 7 5 5 3 3
5 5 7 7 3 3
3 3 7 7 5 5
3 3 5 5 7 7



Wednesday, August 11, 2010

Produce 2 power n series using bitwise operator

I am printing 2n series up to 210

int main()
{
int i;
for(i=0;i<10;i++)
printf("%d\n",1<<i);

return 0;
}

This will be the output of the above code

1
2
4
8
16
32
64
128
256
512

Tuesday, August 10, 2010

Extern variable :predict the output

int i=2;
int main()
{
extern int i;
clrscr();
printf("%d",i);
getch();
return 0;
}
int i=3;