# C++ Basic Mathematical Problems

Now let us apply what we've learned and make simple programs to perform basic mathematical operations. Don't just copy-paste the code try writing the code on your own use these codes as a reference. In these examples I've used only 2 inputs, try to solve the same problems by taking multiple inputs.

## Questions

- Write a program to Prompt the user to input 2 values and display the difference.
- Write a program to prompt the user to input 2 values and display the sum.
- Write a program to prompt the user to input 2 values and display the product.
- Write a program to prompt the user to input 2 variables and display the quotient and remainder.
- Write a program to prompt the user to input marks in 3 subjects( maths, physics, and chemistry) and display the average marks.

## Solutions:

Answer 1

`Answer 2`

`Answer 3`

`Answer 4`

`Modulus operator(%) is used for finding the remainder when the number on the left side of the operator is divided by the number on the right side. In this example, 18 is completely divisible by therefore, the remainder is zero.`

`Note that division is possible only if a is greater than b, in the next chapter we will learn how we can resolve this problem and divide any 2 numbers given to us using conditional statements and relational operators.`

`If you successfully solve these problems, congrats!!! You've mastered the basics of coding.`