Qtr No. 213, New Town Yehlanka
Indore 454775, India
Predict the output of the following code.
public class Main
{
public static void main(String[] args)
{
int[] arr1={5,6,3,1,2};
int n=arr1.length+1;
int s=n*(n+1)/2;
int r=0;
for (int i = 0; i < arr1.length; i++) {
r+=arr1[i];
}
int f=s-r;
System.out.println(f);
}
}
4
3
7
5
To get all Infosys Certified Java SE11 Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee