The Multiplication function and the Void function

 #include <iostream>

using namespace std;

int Mul(int a, int b)

{

    int ans=a*b;

    return ans;

}

void Newfunc()

{

    cout<<"The problem is solved."; //used when no return type output is expected.

}

int main()

{

    int a, b;

    cout<<"Give the numbers:\n";

    cin>>a>>b;

    cout<<"Their product is- \n";

    cout<<Mul(a,b)<<endl;

    Newfunc();

}

---------------------------------------------------------------------------------------------------

Solution-

Give the numbers:

10

8

Their product is- 

80

The problem is solved.



Comments

Popular posts from this blog

Sum of two integers using functions

Capitalizing Function

Prime Numbers and Factorial function