After execution of the code fragment

int temp[5];

int i;

for (i = 0; i < 5; i++)

{

temp[i] = i + 2;

if (i >= 3)

temp[i-1] = temp[i] * 3;

}

cout << temp[3];

what is displayed on the screen?


can someone help me what will the output be i got 6 but i dont know if im right

Respuesta :

It should be 18, the if statement comes into effect at >= 3, before the if statement it is 6, but afterwards it will be 18
RELAXING NOICE
Relax