Saturday, 5 September 2020

Program to find the sum of two numbers

  /*program to find the sum of two numbers*/


#include<stdio.h>

int main()

{

float a,b,sum;

printf("Enter two numbers:");

scanf("%f %f",&a ,&b);

sum=a+b;

printf("%.2f",sum);

return 0;

}

OUTPUT:

Enter two numbers: 4.0 123.8
127.80

Description:

Here we ask the user to input two numbers to be added and display the result.

3 comments:

If you have any doubt, please ask in the comment section.

Search This Blog

Program to print weather the number is happy or not.

#include <stdio.h> #include <math.h> int main () { int i , j , num , temp , sum = 0 ; printf ( "Enter number\n...