C++ Program that Add Sum and Difference of Two numbers using two function - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Thursday, October 24, 2019

C++ Program that Add Sum and Difference of Two numbers using two function

#include <iostream>

using namespace std;
int sum(int a,int b);
int diff(int a, int b);
int main()
{
 int s,d;
 int a,b;
cout<< " Enter the first Number : ";
cin>>a;
cout<< " Enter the first Number : ";
cin>>b;


 s=sum(a,b);
cout<< a<<" + " <<b<<" = "<<s<<endl;
d=diff(a,b);
cout<< a<<" - " <<b<<" = "<<d<<endl;

    return 0;
}
int sum(int a, int b){
int c = a+b;

return c;

}
//second function for difference
int diff(int a, int b){
int c = a-b;

return c;

}



No comments:

Post a Comment

ads1

Post Top Ad