1
The goal of the program is to show only the numbers fulgaps from 0 to 999, this number must be divisible by concatenating the first and last number Ex: 192 / 12 or 583 / 53.
In the compilation is shown all numbers from 1 to 999 and not only the desired numbers. Can anyone tell me what the error of my logic?
#include <iostream>
int main()
{
int Number{ 1 };
int FirstLastNumber = ((Number / 100) * 10) + Number % 10;
int Result = Number % FirstLastNumber;
for (int i = 0; i <= 999; i++)
{
if (Result == 0)
{
std::cout << Number << std::endl;
Number++;
}
}
return 0;
}
Do you understand that the answer you accepted does not do what is in the statement of the question?
– Maniero