KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Give the output of the following:


int a[4]={2,4,6,8};
for(i=0;i<=1;i++)
{
s=a[i]+a[3-i];
System.out.println(s);
}

Java

Java Arrays

103 Likes

Answer

10
10

Working

iOutputRemark
0    a[0] + a[3]
⇒ 2 + 8
⇒10
First Iteration
1    a[1] + a[2]
⇒ 4 + 6
⇒10
Second Iteration

Answered By

60 Likes