29.7k views
5 votes
Write a complete program to read two whole numbers (no decimal point) and print their sum and difference.

User Suchi
by
7.5k points

1 Answer

5 votes

Final answer:

In adding and subtracting whole numbers, the basic principles involve understanding and applying the correct operation based on the signs of the numbers, and considering that whole numbers have an assumed decimal point at the right end.

Step-by-step explanation:

The basic principle to use in working with addition and subtraction of whole numbers is to pay attention to the signs of the numbers and apply the appropriate operations. When working with whole numbers, you want to make sure that you are adding or subtracting only the numerical values and considering the positive or negative signs.

Here are the rules:

  • When two positive numbers add, the sum has a positive sign, e.g., 3+2 = 5.
  • When two negative numbers add, the sum has a negative sign, e.g., -4 + (-2) = -6.
  • When adding two numbers with opposite signs, subtract the smaller number from the larger number and give the result the sign of the larger number, e.g., -5 + 3 = -2.
  • In subtraction, change the sign of the number being subtracted and follow the rules of addition, e.g.,5 - 3 becomes 5 + (-3) which equals 2.

Remember that if the decimal point is not present in a number, it is assumed to be at the right of the number, such as 123 being equivalent to 123. with the decimal point.

User Ranjan
by
8.6k points

No related questions found