Create a program that will allow user to enter two numbers. Using a function, compute and display for its summation.
#include <iostream>
using namespace std;
void summation(double x, double y) {
double z = x + y;
cout << "Sum is " << z << endl;
}
int main() {
double x, y;
cout << "Enter a number: ";
cin >> x;
cout << "Enter another number: ";
cin >> y;
summation(x, y);
return 0;
}
Comments
Leave a comment