#include <stdio.h>
int main() {
int arr[5];
for(int i=0; i<5; i++)
scanf("%d",&arr[i]);
for(int i=0; i<5; i++)
{
int m=arr[i];
for(int j=i+1; j <5; j++)
{
if(m>arr[j])
{
arr[i]=arr[j];
arr[j]=m;
}
}
}
for(int i=0; i<5; i++)
printf("%d ",arr[i]);
return 0;
}
Why is this sorting program not working? Where is this program wrong? This program not sorting the array. Where is it wrong?