Q:

C++ Program To perform All Arithmetic Operations Using Functions

0

Logic :- 

You need to enter two number and pass in All function . If you get any problem then Comment

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;

int sum(int,int);
int sub(int,int);
int mul(int,int);
int div(int,int);
int rem;

int main()
{
 int a,b,m,su,s,d;

 cout<<"Enter Two Numbers : \n";
 cin>>a>>b;

 s=sum(a,b);
 su=sub(a,b);
 m=mul(a,b);
 d=div(a,b);

 cout<<"\nSum : = "<<s<<"\nSubtraction : = "<<su<<endl;
 cout<<"\nMultiplication : = "<<m<<"\n Division : = "<<d<<endl;
 return 0;
}

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

int sub(int a,int b)
{
 rem=a-b;
return(rem);
}

int mul(int a,int b)
{
 rem=a*b;
return(rem);
}

int div(int a,int b)
{
 rem=a/b;
return(rem);
}

 

Output:

Enter Two Numbers :

sum := 1010

subtraction :=990

Multiplication := 10000

Division :=100

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Program To Find GCD Using Functions... >>