Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume that you correct for minor compile-time errors. This program outputs values in an array that are divisible by one number, but not by another.
Assume that you correct for minor compile-time errors. This program outputs values in an array that are divisible by one number, but not by another. Select the statements that are true about running the following code?
- #include
- using namespace std;
- int main() {
- const int TOP = 7;
- int foo[TOP] = {15, 47, 23, 45, 10, 19, 36};
- int y = 0;
- while(y < TOP) {
- if(foo[y] % 5 == 0) {
- y++;
- continue
- }
- if(!(foo[y] % 2)) {
- cout < foo[y] < " ";
- }
- y++;
- }
- cout < end1;
- return 0
- }
Select one or more:
a. The output from this program will be 36
b. The output from this program will be 10 36
c.The while expression on line 8 will be evaluated 8 times
d. The while expression on line 8 will be evaluated 7 times
e. Line 9 should in fact be if(!(foo[y] % 5)) {.
f. Line 13 should in fact be if(foo[y] % 2) {.
Thank you!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started