int main() { int n; printf("Enter the size of the array: "); scanf("%d", &n);
int arr[n]; // Input elements of the array printf("Enter %d elements in the array:\n", n); for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } // Find the maximum element int max = arr[0]; for (int i = 1; i < n; i++) { if (arr[i] > max) { max = arr[i]; } } // Delete the maximum element for (int i = 0; i < n; i++) { if (arr[i] == max) { for (int j = i; j < n - 1; j++) { arr[j] = arr[j+1]; } n--; } } // Print the updated array printf("\nArray after deleting the maximum element:\n"); for (int i = 0; i < n; i++) { printf("%d ", arr[i]); } return 0;
int main() {
int arr[n];int n;
printf("Enter the size of the array: ");
scanf("%d", &n);
// Input elements of the array
printf("Enter %d elements in the array:\n", n);
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
// Find the maximum element
int max = arr[0];
for (int i = 1; i < n; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
// Delete the maximum element
for (int i = 0; i < n; i++) {
if (arr[i] == max) {
for (int j = i; j < n - 1; j++) {
arr[j] = arr[j+1];
}
n--;
}
}
// Print the updated array
printf("\nArray after deleting the maximum element:\n");
for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
return 0;
}