Shakil_Hossain

as

Nov 29th, 2020
460
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.    
  5.     int myArray[100];
  6.     int i, j, size=8;
  7.     int position;
  8.    
  9.     printf("Enter array element\n");
  10.     for(i=0; i<size; i++){
  11.         scanf("%d", &myArray[i]);
  12.     }
  13.    
  14.     printf("Delete element\n");
  15.    
  16.     printf("position to 1st delete from the array: \t");
  17.         scanf("%d", &position);
  18.    
  19.     for ( i = position - 1 ; i < size - 1 ; i++ )
  20.         myArray[i] = myArray[i+1];
  21.    
  22.     printf("\nposition to 2nd delete from the array: \t");
  23.     scanf("%d", &position);
  24.    
  25.     for ( i = position - 1 ; i < size - 1 ; i++ )
  26.         myArray[i] = myArray[i+1];
  27.    
  28.     printf("\nNew array = \t");
  29.     for(i=0; i<size-2; i++){
  30.         printf("%d\t", myArray[i]);
  31.     }
  32.    
  33.     return 0;
  34. }
RAW Paste Data