• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the best way to write this program  RSS feed

 
emeka malachy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how do i make the program print the numbers on his own and then give me average, instead of me typing the number by my self, i have tried all i know but cant get the average after printing the numbers. assist me please
am still novice
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't declare more than one variable per line. Please have a look at our suggestions about formatting, which make the code much easier to read. Thank you for using code tags, but you had them in the wrong place and I have corrected them.

If you want to print each number, or a total, you can add lines to print them all. I suggest you use total / counter rather than writing 10.
I am not sure I understand what you said about typing the numbers. You can read numbers from a file, which you will find about in the Java Tutorials.
 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emeka malachy wrote:how do i make the program print the numbers on his own and then give me average, instead of me typing the number by my self

I really don't understand what you're asking. Can you please clarify?

emeka malachy wrote:i have tried all i know but cant get the average after printing the numbers.

What do you mean exactly? Once I enter 10 numbers, the average is correctly output.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!