+ 4
Challenge: write a code to find whether the given array of interger elements is sorted or unsorted.
identify whether the array elements are sorted or unsorted
3 Antworten
+ 9
use Arrays.sort(array_name); & then by using a loop compare each corresponding element
//alternative method also exists without using any loop
+ 6
It is encouraged to make challenges like this into assignments in lesson factory, rather than post them here in the Q/A
https://www.sololearn.com/discuss/1082512/?ref=app
+ 2
C++
int arr[50]; for(int& i:arr) cin>>i;
cout<<boolalpha<<is_sorted(arr,arr+50);