Programming - Arrays - Discussion

You Are Here :: Home > C++ Language > Arrays - Discussion

 



Q.

What is the value of alpha[3] after the following code executes?
int alpha[5];
int j;
alpha[0] = 5;
for(j = 1; j < 5; j++)
{
if(j % 2 == 0)
alpha[j] = alpha[j – 1] + 2;
else
alpha[j] = alpha[j – 1] + 3;
}                         


A. 10 B. 13
C. 15 D. None of these

Answer: Option B
Explaination:

 


No Explanation




Discussion

Your Comments Goes here...
NameDiscussion