R

Ram Sharma • 193.86K Points
Coach

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;
}
  • (A) 8
  • (B) 9
  • (C) 10
  • (D) None
  • Correct Answer - Option(D)
  • Views: 134
  • Filed under category C++

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics