Brijmohan lal Sahu - Facebook
ads
ads

Friday, October 31, 2014

Program to illustrate function with return type and with arguments



-----------------------------------------------------
/*Program for  function with return type and with arguments */

#include<iostream.h>
#include<conio.h>
void main()
{
int total,a,b;
clrscr();
int sum(int ,int ); //Function declaration
cout<<"\nEnter first number:";
cin>>a;
cout<<"\nEnter Second number:";
cin>>b;
cout<<"Sum of two number:";
total=sum(a,b);
cout<<total; //Function call
getch();
}
int  sum(int a,int b) //Function Definition
{
int c;
c=a+b;
return c;
}

No comments:

Post a Comment