-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathascending.java
More file actions
28 lines (27 loc) · 814 Bytes
/
ascending.java
File metadata and controls
28 lines (27 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.*;
class ascending
{static int i,n,j,ch;
public static void main(String args[])throws IOException
{
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
int a[]=new int[3];
System.out.println("<<< ENTER THREE NUMBERS.... >>>");
for(i=0;i<3;i++)
{
a[i]=Integer.parseInt(buf.readLine());
}
for(i=0;i<3;i++)
for(j=0;j<3-i-1;j++)
{
if(a[j]>a[j+1])
{
int t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
System.out.println("Smallest Number="+a[0]);
System.out.println("Next Higher Number="+a[1]);
System.out.println("Highest Number="+a[2]);
}
}