#include #include #include #include #include #include #include #include main() { int i,size,asc,dsc,array[25]; char resp[10]; clrscr(); printf("\nA program to find weather a mvector is sorted"); do { do { printf("\nHow many elements do you want to enter\n(less than 25) "); scanf("%d",&size); } while(size > 25 || size <= 1); /*size 1 is meaningless here*/ printf("\nEnter the array:"); for(i=0;i array[i+1]) asc = 0; if(array[i] < array[i+1]) dsc = 0; } if(asc) printf("\nThe array is in ascending order"); else if(dsc) printf("\nThe array is in descending order"); else printf("\nThe vector isn\'t sorted"); printf("\nDo again(y/n) "); scanf("%9s",resp); } while(*resp == 'y' || *resp == 'Y'); getch(); }