WHAT'S NEW?
Loading...

Programe to add two numbers in C++ using function

//programme to add to numbers


#include<iostream.h>
#include<conio.h>


void main()
{
    int add(int ,int);                //function prototype
    clrscr();
    int x, y, sum=0;
    cout<<"\n\n Enter two number that u need to add";
    cin>>x>>y;
    sum=add(x,y);                     //function calling
    cout<<"\n the sum of two numbers is =";
    cout<<sum;
}

int add(int a ,int b)
{
    int sum=0;
    sum=a+b;
    return (sum);
}


 

0 comments:

Post a Comment