int x[]={1,4,9,16,25};
intry[]={11};
for(int i=0;i<5;i++)
{
System.out.println(y[0]+x[i]);
}
Answers
Answered by
1
Question:-
Write the output of the following code.
Working Out:-
Given code,
int x[]={1,4,9,16,25};
int y[]={11};
for(int i=0;i<5;i++)
{
System.out.println(y[0]+x[i]);
}
After first iteration, output
=11+1=12
After second iteration, output
=11+4=15
After third iteration, output
=11+9=20
After fourth iteration, output
=11+16=27
After fifth iteration, output
=11+25=37
Output:-
13
15
20
27
37
Answered by
0
Answer:
first output is:11+1=12
second output is:11+4=15
Explanation:
the condition in the for loop is that I should be less than 5 therefore from the X section only first two numbers 1and 4 can be satisfied as they are less than 5..
Similar questions