write a c++ program for function addition?
Answers
Answered by
4
#include <iostream>
#include <stdio.h>
type add(type num1, type num2);
int main ()
{
cout << "Please enter integer 1 : ";
int num1; cin >> num1;
cout << "Please enter integer 2 : ";
int num2; cin >> num2;
answer = add(num1, num2);
cout << "The sum of " << num1 << " & " << num2 << " = " << answer;
getchar();
return 0;
}
type add(type num1, type num2)
{
result = num1 + num2; return result;
}
#include <stdio.h>
type add(type num1, type num2);
int main ()
{
cout << "Please enter integer 1 : ";
int num1; cin >> num1;
cout << "Please enter integer 2 : ";
int num2; cin >> num2;
answer = add(num1, num2);
cout << "The sum of " << num1 << " & " << num2 << " = " << answer;
getchar();
return 0;
}
type add(type num1, type num2)
{
result = num1 + num2; return result;
}
Similar questions