Need Help with the code

What is the correct answer and why?


1
2
3
4
5
6
7
8
9
 int main() {
            float val = 100.0;
            do {
                val = val / 5;
                cout << "*";
            } while(val > 1.0);
            return 0;
    }
  Put the code you need help with here.
What do you mean by correct answer?

Aceix.
All your program will do is print out an '*' for everytime your divide by 5 and the value is still greater than 1. So, it will print out 20 * on one line. What are you attempting to do?
I did it using Netbeans the answer is ***. I do not understand Why? Please help.
BEcause after you divide val by 5 third time result will be less than 1 and loop condition would not be met anyore so program will end.
Topic archived. No new replies allowed.