Q. What is the result of the following C++ program?
Code:
#include <stdio.h>
#include<iostream>
using namespace std;
int main ()
{
int arr[] = {0, 2, 4, 2, 1};
int n, s = 0;
for (n = 0; n < 6; n++) {
s += arr[n];
}
cout << s;
return 0;
}
β
Correct Answer: (D)
None