Write a java application program........?

Ads
 

Write a java application program........?

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

View Answers

April 24, 2012 at 11:37 AM

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");
    }
}

Ads









Related Tutorials/Questions & Answers:
Write a java application program........?
Write a GUI application for the WebBuy Company
Advertisements
write a java program
How to write Java Program
How to write in File in Java
write a programm using java
write java prgram
Java write to file
write a program for complete JDBC based application
write the java program?
write the java program?
Write java program?
Write java program?
Hire developers to write an iPhone Android application
How to write in File in Java
How to Write to file in Java?
Write a program in java...
Java application PLZ ?
Write short note on Java package.
help to write java code
help to write java code
Java Application
Java Client Application example
Java Client Application
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA
write a program in java.
Java Stream Write Exception
Distributed application and java
Java application Help?
Java HTML Client Application

Ads