[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
for and while functions to make a calculation  XML
Forum Index » New to Java
Author Message
NewOrder

Newbie

Joined: 06/22/2010 05:04:50
Messages: 7
Offline


my task is to compose a code, where the user needs to feed 100 numbers. all those numbers need to be averaged out at the end. when i get the final average, i need to filter out all the numbers that he typed that are above the average.


here is my code so far. what i dont get , is how to store all the numbers that he typed and then apply them second time to compare against the final average.

# class Ex33
# {
# public static void main(String[] args)
# {
# Console console=System.console();
# System.out.println("Please enter a number");
# String input;
# input=console.readLine();
# int n1;
# n1=Integer.parseInt(input);
# double sum;
# int LessThanAv;
#
#
# for(count=0;count<100;count++)
# { sum=(n1+sum)/count;
# System.out.println("Please enter the next number");
#
# }
#
# while(n1<sum
# {
# System.out.println(n1);
# }
# }
#
# }
 
Forum Index » New to Java
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle