##Problem 2.7 :: Write a program to do the following:

(a) Declare x and y as integer variables and z as a short integer variable.

(b) Assign two 6 digit numbers to x and y.

(c) Assign the sum of x and y to z.

(d) Output the values of x, y and z.



## solution ::

## Write down headers yourself.


void main()
{
long x,y;
short z;
clrscr();
printf("Input two 6 digit number to x and y:");
scanf("%d %d",&x,&y);
z=x+y;
printf("\nx=%d",x);
printf("\ny=%d",y);
printf("z=%d",z);
getch();

}

0 comments