0

Can you show me how to get the exact answer (output) of this?

int arr[]=new int[3]; for (int i=0; i<arr.length; i++){ arr[i]=i; } int res=arr[1]+ arr[2]; System.out.printIn(res);

18th Oct 2020, 3:14 AM
John Raven Caiña
John Raven Caiña - avatar
10 Answers
+ 1
The first error is Put a curly brace } after arr[i] Second one is Plz write System.out.print() or, system.out.println() https://code.sololearn.com/cs3nbaAr8I6z/?ref=app
18th Oct 2020, 3:25 AM
Indranil
Indranil - avatar
+ 1
I can't understand your query
18th Oct 2020, 3:30 AM
Indranil
Indranil - avatar
+ 1
Ans is 3
18th Oct 2020, 3:33 AM
Indranil
Indranil - avatar
+ 1
Just compile the program given below ok
18th Oct 2020, 3:33 AM
Indranil
Indranil - avatar
+ 1
Because arr[0]=0 arr[1]=1 arr[2]=2
18th Oct 2020, 4:51 AM
Indranil
Indranil - avatar
0
But can ou showe the answer i reallfy don't know:((
18th Oct 2020, 3:28 AM
John Raven Caiña
John Raven Caiña - avatar
0
Can you show me the output of that program? Cause I don't know the answer.
18th Oct 2020, 3:32 AM
John Raven Caiña
John Raven Caiña - avatar
0
How do i write it just 3 sir?
18th Oct 2020, 3:34 AM
John Raven Caiña
John Raven Caiña - avatar
0
Thank you!
18th Oct 2020, 4:52 AM
John Raven Caiña
John Raven Caiña - avatar
0
You are most welcome
18th Oct 2020, 5:42 AM
Indranil
Indranil - avatar