Answer to Question #254839 in C++ for tourist

Question #254839

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


1
Expert's answer
2021-10-21T16:03:49-0400

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS