-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab2b.cpp
More file actions
32 lines (26 loc) · 734 Bytes
/
Copy pathlab2b.cpp
File metadata and controls
32 lines (26 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Include statements
#include <iostream>
using namespace std;
// Main function
int main ()
{
// Constant declaration
double x = 100;
// Get user input
double y = 0;
cout << "Enter value for y: " << endl;
cin >> y;
// Perform arithmetic operations
double sum = x + y;
double difference = x - y;
double quotient = x / y;
double remainder = int(x) % int(y);
double product = x * y;
// Print results
cout << "The sum (x + y) is: " << sum << endl;
cout << "The difference (x - y) is: " << difference << endl;
cout << "The quotient (x / y) is: " << quotient << endl;
cout << "The remainder (x % y) is: " << remainder << endl;
cout << "The product (x * y) is: " << product << endl;
return 0;
}