Write a program to do the followings:
• Read a number from the user ( N1 ), and check if it exactly has 3 digits.
• Read another number from the user ( N2 ), and check if it exactly has 3 digits.
• In (N1) check that the multiplication of the most left 2 digits is equal to the most right digit.
• In (N21) check that the multiplication of the most right left 2 digits is equal to the most left digit.
• In case the previous checks were true, then compose a new variable that carries the most right digit of (N1), & the most left digit of (N2).
N1 : 236 (2 x 3 = 6)
N2 : 824. (8 = 2 x 4)
The '%' (mod) operator, which returns the remainder after dividing, will be helpful here.
To get a certain digit of a number, you mod it by its place + 1, and then divide it by its place.
To get 3 (it's in the 10^3 or 1000ths place):
823467 % 10^4 = 3467
3467 / 10^3 = 3
(Note that the caret symbol '^' DOES NOT MEAN "to the power of" in C++. You can use pow() from <cmath> to do this instead)
Using mod on a number (by a multiple of 10) essentially gets rid of unwanted leftmost digits, while dividing gets rid of rightmost digits. Use this concept to find out how to get the leftmost 2 digits of a number or the rightmost 2.