Pages

Tuesday, June 14, 2016

C program to read two floating point numbers and display answer on screen.


#include<stdio.h>
int main()
{
float f1,f2, total;

printf("Enter floating point number1:");
scanf("%f",&f1);

printf("Enter floating point number2:");
scanf("%f",&f2);

total = f1 + f2;

printf("Addition is %f ",total);
 return 0;
}

Output of program

Enter floating point number1:2.25
Enter floating point number2:3.25
Addition is 5.500000

No comments:

Post a Comment