Welcome every One : I have Q in Java?
Q : Write a java application program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers less than 100?
thanks
import java.util.*;
class NumberExample
{
public static void main(String[] args)
{
int count1=0;
int count2=0;
Scanner input=new Scanner(System.in);
System.out.println("Enter 20 numbers:");
int i=1;
while(i<=20){
int num=input.nextInt();
if(num>100){
count1++;
}
else if(num<100){
count2++;
}
i++;
}
System.out.println(count1+" numbers are greater than 100");
System.out.println(count2+" numbers are smaller than 100");
}
}