Online Computer Courses Classes and Training Program

Return data type and passing argument in user defined function


#include<iostream>
int sum(int a, int b);

using namespace std;
main()
{
               int x,y,result;
               cout<<"enter two number:";
               cin>>x>>y;
               result=sum (x,y);
               cout<<"sum="<<result;
               return 0;
              
}
int sum(int a,int b)
{
               int c;
               c=a+b;
               return (c);
              
}

Post a Comment

0 Comments