Write a program that prompts the user to input three numbers.

The program should then output numbers in ascending order.

Questions by qwerty0605

Showing Answers 1 - 3 of 3 Answers

Rashmi

  • Jan 22nd, 2012
 

Code
  1. span style="color: #006699;">java.io.*java.util.*"Input three numbers"","+i[1]+","+i[2

  2. }

  3.  

  4. }

  Was this answer useful?  Yes

NARESH KUMAR

  • Feb 3rd, 2012
 

Code syntax is:-

Code
  1. span style="color: #006699;">java.util.Scanner//value 1st

  2. //value 2nd

  3. //value 3rd

  4. }//end of main method

  5. }// end of class

  Was this answer useful?  Yes

vishnu

  • Feb 24th, 2012
 


import java.util.Iterator;
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;


public class ascend {

static int i=0;
public static void main(String[] args)
{
SortedSet elements = new TreeSet();
for(int j=0;j<3;j++)
{
Scanner sc=new Scanner(System.in);
i=sc.nextInt();
elements.add(i);
}
Iterator iter = elements.iterator();
while (iter.hasNext()) {
System.out.println("Element in set is --> "+iter.next());
}}}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions