Step 1: Start
Step 2: Declare an array of size 7, integer i, pos
Step 3: Print the initial array
Step 4: Read the position to delete
Step 5: Shift elements to the left from the given position
Step 6: Print the updated array
Step 7: End
#include <stdio.h> int main() { int ar[7] = {10, 20, 30, 40, 50}, i, pos; printf("\nPrint Array"); for (i = 0; i < 5; i++) { printf("\n%d", ar[i]); } printf("\nEnter position to delete:"); scanf("%d", &pos); // Validate position if (pos < 0 || pos >= 5) { printf("\nInvalid position!"); return 1; } // Shift elements for (i = pos; i < 4; i++) { ar[i] = ar[i + 1]; } printf("\nPrint New Array"); for (i = 0; i < 4; i++) { printf("\n%d", ar[i]); } return 0; }
Print Array 10 20 30 40 50 Enter position to delete: 2 Print New Array 10 20 40 50