plz urgent no spam...
Attachments:
Answers
Answered by
5
Answer:
8 times
Understanding the códe...
- initially, count = 1
- now while loop runs until count<=15
- Each iteration, '***' is printed on the condition that count is odd number (odd numbers have remainder 1) otherwise, "+++++" is printed.
- count is incremented.
Solution(with explaination):
- when count=1,
- while loop begins at the condition that could is less than or equal to 15
- 1<=15, condition true.
- Is 1%2==1? Yes *3 asterisk(*) is printed.
- count=2
- is 2<=15? Yes
- 2%2==1? No, condition false, "+++++" is printed.
- count becomes 3
- 3<=15? Yes
- 3%2==1? Yes, *** is printed
- ...and so on till count becomes 15
- when count becomes 16, loop terminates.
Output will be like...
***
+++++
***
+++++
***
+++++
***
+++++
***
+++++
***
+++++
***
+++++
***
As we can see here, *** is printed 8 times, so answer is 8.
Similar questions