Write a program by using prototype method in c++

 Que - make a program for adding two numbers by prototype method?

#include<iostream>
using namespace std;

int sum(int a,int b)
{
int c;
c=a+b;
cout<<"sum of two numbers is :- "<<c;
return c;
}

int main()
{
    int a,b;
    cout<<"enter 1 number :- ";
    cin>>a;
    cout<<"enter 2 number :- ";
    cin>>b;
    sum(a,b);
    return 0;
}

Result:-



Post a Comment

Previous Post Next Post