class comm.
{
public static void main (String args [] )
{
int I,j,k ;
k= args.length;
String temp;
for(i=0; i<k-1 ; i++ )
{
for (j=0;j<k;j++)
{
if(Integer.parseInt(args[ j ])<Integer.parseInt ( args [ j + 1 ]))
{
temp = args [j ];
args [j] =args [ j+ 1];
args[j + 1]= temp;
}
}
}
for(i=0 ;I <args.length; i ++)
{
System.out.println(args [ I ]);
}
}
}
Output:
java comm. 12 2 3 1 46
1
2
3
12
46
0 comments:
Post a Comment