Saturday, 5 July 2014

C++ program to illustrate function with arguments and return value


Here is a C++ program to illustrate function with arguments and return value


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int sum(int,int);
int main()
{
    int a,b,c;
    cout<<"Enter two numbers ";
    cin>>a>>b;
    c=sum(a,b);
    cout<<"Sum = "<<c;
    return 0;
}
int sum(int x,int y)
{
    int c;
    c=x+y;
    return c;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment