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.
#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;
}
Comments
Leave a comment