C++ program to write a function with prototype int Increase(int num,int n) to increase num by n

//make n optional and use 10 as default value
#include <iostream>
using namespace std;
int even(int num,int n=10)
{
    return num+n;
}
int main()
{
    int num;
    cout<<"Enter a number: ";
    cin>>num;
    cout<<"The incremented value is "<<even(num);
    return 0;
}

No comments:

Post a Comment