// Create a Program that will calculate the Addition, Subtraction, Multiplication, Division of 5 numbers.
#include <iostream>
using namespace std;
int main(){
/* Variable declation */
int v, w, x, y, z;
int sum, difference, product;
float quotient;
// Taking input from user and storing it
// in v , w , x , y , and z
cout << "Enter First Number\n";
cin >> v;
cout << "Enter Second Number\n";
cin >> w;
cout << "Enter Third Number\n";
cin >> x;
cout << "Enter 4th Number\n";
cin >> y;
cout << "Enter 5th Number\n";
cin >> z;
// Adding 5 numbers
sum = v + w + x + y + z;
// Subtracting 5 numbers
difference = v - w - x - y - z;
// Multiplying 5 numbers
product = v * w * x * y * z;
// Dividing 5 numbers by typecasting one operand to float
quotient = (float)v / w / x / y / z;
cout << "\nSum = " << sum;
cout << "\nDifference = " <<difference;
cout << "\nMultiplication = " << product;
cout << "\nDivision = " << quotient;
return 0;
}
sana makatulong
ikaw nalang mag palit ng variable.. kung trip mo palitan..
// Create a Program that will calculate the Addition, Subtraction, Multiplication, Division of 5 numbers.
#include <iostream>
using namespace std;
int main(){
/* Variable declation */
int v, w, x, y, z;
int sum, difference, product;
float quotient;
// Taking input from user and storing it
// in v , w , x , y , and z
cout << "Enter First Number\n";
cin >> v;
cout << "Enter Second Number\n";
cin >> w;
cout << "Enter Third Number\n";
cin >> x;
cout << "Enter 4th Number\n";
cin >> y;
cout << "Enter 5th Number\n";
cin >> z;
// Adding two numbers
sum = v + w + x + y + z;
// Subtracting two numbers
difference = v - w - x - y - z;
// Multiplying two numbers
product = v * w * x * y * z;
// Dividing two numbers by typecasting one operand to float
quotient = (float)v / w / x / y / z;
cout << "\nSum = " << sum;
cout << "\nDifference = " <<difference;
cout << "\nMultiplication = " << product;
cout << "\nDivision = " << quotient;
return 0;
}