Computer Science, asked by ASPARAGOS4125, 7 months ago

Write a program to store 10 names in an array A?}

Answers

Answered by Anonymous
0

Answer:

mark brainliest

Explanation:

import java . util. *;

class arrange

{

public static void main(String args[])

{

String n[] = new String[10]:

String s=" ";

int i, j;

Scanner Sc=new Scanner(System . in);

System . out. println("Enter the names");

for(i=0;i<10;i++)

{

n[i] = sc . next();

}

for(i=0;i<9;i++)

{

for(j=0;j<(9-i) ;j++)

{

if(n[j] . compareTo(n[j+1]>0)

{

s=n[j]

n[j]=n[j+1]

n[j+1]=s;

}

}

System . out. println("THE SORTED LIST IS");

for(i=0;i<10;i++)

{

System . out. println(n[i]);

}

}

}

Answered by nehasahani23
0

firstly tell in which language you want to answer c c++ or what

Similar questions