In the module "Arithmetic Expressions" we talked about the features of the division operation in C ++.
Recall that for integer data (type int), you can use two division operations.
/ - integer division, when the fractional part is discarded as a result of the division operation
% - calculation of the remainder of the division
ЗАПОМНИМ!
n C and C ++, the result of dividing an integer by an integer is always an integer, the remainder when dividing is discarded.
Пример:
int a, b;
a = 10;
b = 3;
int c = a / b; // Answer: с = 3
int d = a% b; // Answer: d = 1
These operations are very important in programming. They need to be understood and used correctly. And this requires practice!