# Program To Perform All Arithmetic Operations Using Functions

• December 5, 2022
• C++

For two variables entered by the user, we must create separate functions for addition, subtraction, division, and multiplication.

Program Code:

``````
#include <iostream>
using namespace std;
int subtraction(int, int);
int multiplication(int, int);
float division(int , int);
int modulus(int , int );

{
int sum = num1 + num2;
return sum;
}

int subtraction(int num1, int num2)
{
return num1 - num2;
}

int multiplication(int num1, int num2)
{
return num1 * num2;
}

float division(int num1, int num2)
{
return num1 / num2;
}

int mod(int num1, int num2)
{
return num1 % num2;
}

int main()
{
int a, b;

cout<<("Enter the First Number  = ");
cin>>a;

cout<<("Enter the Second Number = ");
cin>>b;

cout<<("Arithmetic Operations on Integer Values\n");

cout<<"subtraction    = "<< subtraction(a, b);
cout<<"multiplication = "<< multiplication(a, b);
cout<<"division       = "<<division(a, b);
cout<<"modulus        = "<< mod(a, b);
}``````

Output:

``````Enter the First Number  = 23
Enter the Second Number = 12
Arithmetic Operations on Integer Values
subtraction    = 11
multiplication = 276
division       = 1
modulus        = 11``````