Arithmetic Operators

Lab C++ Beginner 10 points

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
Sample input available Sample output available
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;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD