tasks says;

Task: Write a program that
1. reads from the console number N > 0
2. then reads from the console N numbers
3. displays the maximum of N numbers typed in.

i have done two steps but how can i find the maximum of them? please anyone help me My code;public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int getNum=Integer.parseInt(reader.readLine()); while(getNum<=0 ) { getNum = Integer.parseInt(reader.readLine()); } int a=Integer.parseInt(reader.readLine()); while(a!=getNum) { a=Integer.parseInt(reader.readLine()); } }

asked 26 Apr '15, 22:25

rahul's gravatar image

rahul
7916
accept rate: 15%


Your code is completely wrong. Can you explain what it does? Because it doesnt do the task

link

answered 13 May '15, 03:14

dimashaman's gravatar image

dimashaman
262
accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×30
×4

Asked: 26 Apr '15, 22:25

Seen: 1,417 times

Last updated: 13 May '15, 03:14