Hello friends,
public static void main(String[] args) {
int arr[]={1,2,3,4,5};
int arr[]={1,3,5,2,7,33,55,33,22,11,55,100,9};
boolean sorted = true;
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i] > arr[i+1]) {
sorted = false;
break;
}else {
sorted=true;
}
}
}
Thank you
public static void main(String[] args) {
int arr[]={1,2,3,4,5};
int arr[]={1,3,5,2,7,33,55,33,22,11,55,100,9};
boolean sorted = true;
for (int i = 0; i < arr.length - 1; i++) {
if (arr[i] > arr[i+1]) {
sorted = false;
break;
}else {
sorted=true;
}
}
}
Thank you
No comments:
Post a Comment