## Problem 2.8 :: Write a program to read two floating point numbers using a scanf statement, assign their sum to an integer variable and then output the values of all the three variables.
## Solution ::
## Write down headers yourself.
void main()
{
float a,b;
int sum;
clrscr();
printf("Input float a & b:");
scanf("%f %f",&a,&b);
sum=a+b;
printf("\nThe summition is=%d",sum);
getch();
}
Add two floating point number
Posted by Bijon Labels: ansi c balagurusamy, ansi c solutions, balagurusamy programming solution, c how to program solutions, c programing, c programming tutorial, homework solution, problem solutions, program solutionsBalagurusamy 2_7
Posted by Bijon Labels: ansi c balagurusamy, ansi c solutions, balagurusamy programming solution, c how to program solutions, c programing, c programming tutorial, homework solution, problem solutions, program solutions##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();
}
Subscribe to:
Posts (Atom)

