Write a program that read two float number a and b from the user, and prints sum of these numbers.
Source code
#include <iostream>
using namespace std;
int main()
{
float a, b;
cout<<"\nEnter a: ";
cin>>a;
cout<<"\nEnter b: ";
cin>>b;
float sum=a+b;
cout<<"\nThe sum of "<<a<<" and "<<b<<" = "<<sum;
return 0;
}
Output
Comments
Leave a comment