C++ Function Introduction

#include<iostream>
using namespace std;
void add(int a, int b)
{
    int sum = a + b;
    cout << "Summation is :: " << sum << endl << endl;
}

void sub(int a, int b)
{
    int subt = a - b;
    cout << "Subtraction is :: " << subt << endl << endl;
}

void mult(int a, int b)
{
    int mul = a*b;
    cout << "Multiplication is :: " << mul << endl << endl;
}

float dive(int , int);

int modl(int, int);

int main()
{
    int a, b;

    cout << "Enter A Big and Little Number : ";
    cin >> a >> b;
    cout << endl;

    add(a, b);
    sub(a, b);
    mult(a, b);

    float c = dive(a, b);
    cout << "Division is :: " << c << endl << endl;

    int d = modl(a, b);
    cout << "Modulus is :: " << d << endl << endl;

    return 0;
}

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

int modl(int a, int b)
{
    int mod = a % b;
    return mod;
}

Comments