What will be the output of the following C++ code snippet? 1. #include <stdio.h> 2. #include<iostream> 3. using namespace std; 4. int main () 5. { 6. int array[] = {0, 2, 4, 6, 7, 5, 3}; 7. int n, result = 0; 8. for (n = 0; n < 8; n++) 9. { 10. result += array[n]; 11. } 12. cout << result; 13. return 0; 14. } a) 21 b) 27 c) 26 d) 25
What will be the output of the following C++ code snippet? 1. #include <stdio.h> 2. #include<iostream> 3. using namespace std; 4. int main () 5. { 6. int array[] = {0, 2, 4, 6, 7, 5, 3}; 7. int n, result = 0; 8. for (n = 0; n < 8; n++) 9. { 10. result += array[n]; 11. } 12. cout << result; 13. return 0; 14. } a) 21 b) 27 c) 26 d) 25
Share
b) 27