F Additon of two numbers in CPP using Function | CodeTheta

Additon of two numbers in CPP using Function

July 25, 2019

Code : 
#include<iostream>
#include<conio.h>
using namespace std;

int AddFunction(int, int);

int main() {
    int n1, n2, result;
    cout<<"Enter First Number: ";
    cin>>n1;
    cout<<"Enter Second Number: ";
    cin>>n2;   
    result = AddFunction(n1, n2);
    cout<<"Result is: "<<result;
}

int AddFunction(int x, int y) {
    int output;
    output = x + y;
    return output;
}


Output :
Enter First Number: 6
Enter Second Number: 3
Result is: 9


IDE Used To Test This Code : DEV C++.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment