Computer Science, asked by roh4, 1 year ago

write a program in java to accept 10 names and print in lenght wise in ascending orders of the names

Answers

Answered by chaitanyakrishn1
0
Import java.util.Scanner;
Class jav
{
Public static void main ( String args [ ] )
{
Scanner in = new Scanner ( System.in);
System.out.println ( "enter ten names");
String a []=new String [10];
for (int s =1; s <= 10; s++)
{
a=in.nextline ();
}
for (int m=1; m <=8; m++)
{
for (int I = 1; I < = 8; I + + )
{
If (a [l].compareToa. [l+1]> 0)
{
Int x= a [l];
a [l]=a [l+1];
a [l+1]=x;
}
}
}

Hope it helps
Thank u ★ ★ ★
#ckc
Similar questions