My question is the following, i'm just figuring out this language, now my question is about the "n" number.
What is the role of n<5, i know after this condition it continues the for or not.
But i can't find the precise explanation of the "n" . Thank you.
Why are n<5 and n<6 outputting the same result? And why n<4 is so small?
n<4 outputs 135
n<5 outputs 12206
n<6 outputs 12206
n<7 outputs 12207
n<8 outputs 12208
#include <stdafx.h>
#include <iostream>
using namespace std;
int billy [] = {16, 2, 77, 40, 12071};
int n, result=0;
int main ()
{
for ( n=0 ; n<5 ; n++ )
{
result += billy[n];
}
cout << result << endl;
return 0;
}