C Programming
Computer Programming

Program in C to delete a number from array that is already stored in ascending order



Write a Program in c to delete a number from array that is already stored in ascending order

\* C Program to to delete a number from array that is already stored in ascending order *\

# include < stdio.h >
int   main( )
{

int   a[20], i, n, ele  ;
printf(" Enter the Numbers of elements: ") ;
scanf("%d ", & n) ;
printf("\n Enter the element of araay in Assending Order : \n") ;
for (  i = 1 ; i < = n ; i++ )
scanf("%d ", & a[i]) ;
printf("\n Array enter by user are :\n") ;
for (  i = 1 ; i < = n ; i++ )
printf("%d \t", a[i]) ;

printf("\n Enter a number you want to delete :") ;
scanf("%d ", & ele) ;

for (  i = 1 ; i < n ; i++ )
{

if (  a[i] < ele  )
a[i] = a[i] ;
else
a[i] = a[i+1] ;

}
printf("\n Array after deleting a number are :\n") ;
for (  i = 1 ; i < n ; i++ )
pcanf("%d \t", a[i]) ;
return ( 0 ) ;

}

Output of Program :

Output of Program in C to delete a number from array that is already stored in ascending order