Answer to Question #340891 in C++ for Kireina

Question #340891

Make a c++ program that will input two numbers and display the sum of numbers. Do this five times. Use function for the computation of the sum.


1
Expert's answer
2022-05-14T16:39:19-0400






#include <iostream>
//represent function wich add two integerr numbers
int sum(int a,int b)
{
  return a+b;
}
using std::cout;
using std::cin;
int main() {
  for(int i=0;i++<5;)
    {
      int a,b;
      cout<<"Please input first number: ";
      cin>>a;
      cout<<"Please input second number: ";
      cin>>b;
      cout<<"sum: "<<sum(a,b)<<std::endl;
    }
  return 0;
}

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