while loop
how to change if statement to while loop
{
int input;
cout << "Input an integer between 1 and 9999: ";
cin >> input;
int temp = input;
int d = 1;
if (input <= 0)
{
return;
}
if (temp > 9)
{
temp = temp / 10;
d++;
}
if (temp > 9)
{
temp = temp / 10;
d++;
}
if (temp > 9)
{
temp = temp / 10;
d++;
}
if (temp > 9)
{
temp = temp / 10;
d++;
}
Topic archived. No new replies allowed.