Answers for "summation of numbers using function"

C++
0

summation of numbers using function

#include <iostream>
using namespace std;


int sum(int a, int b)
{
    cout<<"\n Using function with 2 arguments"<<endl;
    return a+b;
}

int sum(int a, int b, int c)
{
    cout<<"\n Using function with 3 arguments"<<endl;
    return a+b+c;
}
int main()
{
    cout<<"The sum of 3 and 6 is "<<sum(3,6)<<endl;
    cout<<"The sum of 3, 7 and 6 is "<<sum(3,7,6)<<endl;
    return 0;
}
Posted by: Guest on April-19-2022

Code answers related to "summation of numbers using function"

Browse Popular Code Answers by Language