ganatantranepal has done it pretty nicely, mine looks messsy, this will take 10 input from user
import java.lang.*;
import java.io.*;
public class jayNepal {
public static void main(String[] args) throws Exception
{
// Read from console
BufferedReader stdin = new BufferedReader
(new InputStreamReader(System.in));
int[] a=new int[10];
for(int i=0;i<10;i++)
{
System.out.println("Enter value:");
String input = stdin.readLine(); // from console input example above.
a[i] = Integer.parseInt( input );
}
//Sort
for(int i=0;i<10;i++)
for(int j=i;j<10;j++)
{
if(a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
//Count
System.out.println("Number\tCount");
System.out.print(a[0]+"\t");
int count=1;
for(int i=1;i<10;i++)
{
if(a[i]==a[i-1])
{ count++;}
else
{
System.out.print(count +"\n" + a[i]+"\t");
count=1;
}
}
System.out.print(count);
}
}