Program to delete a value from a given array such that array remains sorted

Sorted Deletion in an Array:

Deletion is same as in previous post with the only difference that if the given array is sorted, then the deletion automatically will result in a sorted array.

/* Sorted Deletion */

#include <stdio.h>

#define MAX 10

int main(){
int arr[MAX],n,i,num;
printf(“nEnter total numbers?”);
scanf(“%d”,&n);
for(i=0;i<n;i++){
printf(“nEnter number?”);
scanf(“%d”,&arr[i]);
}
printf(“nEnter the number to delete?”);
scanf(“%d”,&num);
for(i=0;i<n;i++){
if(arr[i] == num)
break;
}
if(i == n){
printf(“nNumber not found”);
return;
}
for(;i<n;i++)
arr[i] = arr[i+1];
printf(“nArray after deletion:”);
for(i=0;i<n-1;i++)
printf(“%dt”,arr[i]);
}