Simple Adder in C++ (Adding Two Numbers)

#include<iostream>

using namespace std;

int sum(int a, int b)

{

return a + b;

}

int main()

{

int num1, num2, sum_num;

cout << “Enter the first number:”;

cin >> num1;

cout << “Enter the second number:”;

cin >> num2;

sum_num = sum(num1, num2);

cout << “The sum of the two numbers is:” << sum_num << endl;

system(“pause”);

return 0;

}

Leave a Comment