Pages

Sunday, July 10, 2011

C - Logics part-1

Follow the following programs written below :-
1. 

#include<stdio.h>
int lmn();
int pqr();
int ppp();
int hhh();
int fff();
void main()
{
 printf("%d %d %d %d",lmn(), pqr(), ppp(),hhh(), fff());
}
int lmn()
{
printf("One\n");
return 1;
}
int pqr()
{
printf("two\n");
return 2;
}
int ppp()
{
printf("Three\n");
return 3;
}
int hhh()
{
printf("Four\n");
return 4;
}
int fff()
{
printf("five\n");
return 5;
}
/* Try to understand output of this by your own.
-----------------------------------------------------------------
2.

#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d\n",x*y,x++,y++);


}


Output:-
121 10 10


-----------------------------------------------------------------
3.
#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d\n",x*y,++x,++y);


}




Output:-
121 11 11


-----------------------------------------------------------------
4.


#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d %d\n",x*y,--x,++x,++y);


}




Output:-
110 10 11 11

-----------------------------------------------------------------
5.


#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d %d\n",x*y,x--,++x,++y);


}




Output:-
110 11 11 11

-----------------------------------------------------------------
Note:- If you get doubts in any program then plz ask me by doing comments.
-----------------------------------------------------------------