/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
int sum=0;
Scanner input = new Scanner(System.in);
int i = 0; // array starts from 0
int [] array = new int[100]; // create larger array
while(i < array.length && sum <= 100) // i should be less then length
{
System.out.println("Write in the " + i + " number") ;
array[i] = input.nextInt();
sum += array[i];
System.out.println("sum is " + sum);
i++; // increment i
}
}
}
Write in the 0 number
sum is 45
Write in the 1 number
sum is 49
Write in the 2 number
sum is 55
Write in the 3 number
sum is 62
Write in the 4 number
sum is 130