Arithmetic Operators
Completed
Read two positive integers and print their sum, difference, product, quotient and remainder, one per line.
Input
Two integers.
Output
Five lines.
Example
Input
17 5
Output
22 12 85 3 2
Editor
C++
Hints
/ between ints truncates; % gives the remainder.
Solution explanation
Integer arithmetic in C++ works exactly like in C.
Show solution
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a + b << "\n" << a - b << "\n" << a * b << "\n" << a / b << "\n" << a % b << "\n";
return 0;
}