QUESTION 1: LOOPING
1. Suppose we want to validate the data captured for two variables programsDone and result in a while loop. The loop should be repeated until the value of result is greater than or equal to 50 and the value of programsDone is greater than or equal to 5. The variables result and programsDone are both of type int. Complete the while loop below. You only have to write down the completed while loop. [5 Marks]
1
Expert's answer
2020-04-24T11:32:41-0400
int result;
int programsDone;
std::cout << "Key in the result followed by the number of programs done: " << endl;
std::cin >> result >> programsDone;
while (result <= 5 && programsDone <= 50) {
result++;
programsDone += 10;
}
Comments
Leave a comment