Big Data and Hadoop Training @$80 or Rs. 6,000 only - valid till Oct 17th Apply Now!

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
write a program for complete JDBC based application
Hire developers to write an iPhone Android application
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 java program?
write the java program?
write the java program?
Write java program?
How to write in File in Java
How to Write to file in Java?
Write a program in java...
Java application - Java Beginners
help to write java code
help to write java code
WRITE A PROGRAM IN JAVA
write program - Java Beginners
Write short note on Java package.
WRITE A PROGRAM IN JAVA
pls provide steps to write ejb3.0 simple application in eclipse - EJB
write a program in java.
Java Stream Write Exception
write a program - Java Beginners
How to write Example code for CRUD application in hibernate annotation?
write an application that print out the even numbers between the range 100-200
how a write a server side progranming in j2sdk for j2me application

Ads