import java.util.*;
import java.io.*;
public class First {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
First oj = new First();
int arry[] = new int[10];
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<10;i++){
arry[i] = Integer.parseInt(br.readLine());
}
oj.display(arry);
Arrays.sort(arry);
System.out.println("After sorting the values");
oj.display(arry);
}
void display(int arr[]){
for(int k : arr){
System.out.println("The value of array is " +k);
}
}
}
import java.io.*;
public class First {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
First oj = new First();
int arry[] = new int[10];
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<10;i++){
arry[i] = Integer.parseInt(br.readLine());
}
oj.display(arry);
Arrays.sort(arry);
System.out.println("After sorting the values");
oj.display(arry);
}
void display(int arr[]){
for(int k : arr){
System.out.println("The value of array is " +k);
}
}
}
output:-
11
33
55
77
33
21
54
00
56
40
The value of array is 11
The value of array is 33
The value of array is 55
The value of array is 77
The value of array is 33
The value of array is 21
The value of array is 54
The value of array is 0
The value of array is 56
The value of array is 40
After sorting the values
The value of array is 0
The value of array is 11
The value of array is 21
The value of array is 33
The value of array is 33
The value of array is 40
The value of array is 54
The value of array is 55
The value of array is 56
The value of array is 77
No comments:
Post a Comment