Hi, I have a small issue here.
c Code:
int main()
{
// Declaring variable
int n, r, y;
bool found;
do
{
found = false;
cout <<
"Enter an integer: ";
cin >> n;
while (n > 0)
{
r = n % 10;
if (r == 0)
{
found = true;
break;
}
else if (r == 1)
{
found = true;
break;
}
else
{
do
{
for (int k = r; k > 0; k--)
{
}
for (int y = r; y > 0; y--)
{
}
r--;
} while (r > 0);
}
n /= 10;
}
} while (found == true);
return 0;
}
Basically, a user will input a integer and it will check if it's the integer contains 1 or 0, if it is, then reject the integer and ask the user to input again.
Once it is checked that it does not contain 1 or 0, it will print out the value using the for-loop.
My issue here is only when the the last digit is 1 then it will ask for the new integer straight else if it is something like 5215, it will loop through for the for-loop before asking for the new integer.
Some logic error here but I can't make it out.