More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. public class Class{
public static void main(String[] args){
List<Integer> collector = new ArrayList();
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
while(x != 0){
collector.add(x);
x = scanner.nextInt();
}
System.out.println(collector.stream().collect(Collectors.averagingInt(p->((Integer)p))));
}
}
Help us improve. Please let us know the company, where you were asked this question :