wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes write a java program to determine the smallest and largest of two numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "write a java program to determine the smallest and largest of two numbers" Watch "write a java program to determine the smallest and largest of two numbers" New topic
Author

write a java program to determine the smallest and largest of two numbers

Bill Zelan
Ranch Hand

Joined: Jan 09, 2009
Posts: 46
can someone help me to code this :
thanks

Using the "input stream reader" functions, write a java program to determine the smallest and largest of two numbers.

1. create some variables named number1, number2, smallest, and biggest (all numbers should be integers).
input the values of the variables number1 or number2 from the keyboard (using input stream reader).
2. print out the sentence "The larger number is " followed by the value that is larger (either the value of number1 or number2) - use the if statement to find out which variable holds the larger value.
3. print out the sentence "The smaller number is " followed by the value that is smaller (either the value of number1 or number2) - use the if statement to find out which variable holds the smaller value.
4. test your program by inputting different values for the variables number1 and number2.
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Give a shot yourself first, then if you get stuck with coding post what you have so far.



Hunter.


"If the facts don't fit the theory, get new facts" --Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: write a java program to determine the smallest and largest of two numbers
 
Similar Threads
GCD/LCM problems
Simple Java problem
Number calculations
So, which of these would be...
Program Problem