Question #254839

Write a program that read two float number a and b from the user, and prints sum of these numbers.


Expert's answer

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





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS