#include <stdio.h>
int main() {
int n, i, position, newValue;
printf("Enter the size of the array: ");
int arr[n];
printf("Enter %d elements of the array:\n", n
); for (i = 0; i < n; i++) {
}
printf("Enter the position to replace (1 to %d): ", n
);
if (position < 1 || position > n) {
printf("Invalid position!\n"); return 1;
}
printf("Enter the new value: ");
// Replace the value
arr[position - 1] = newValue;
for (i = 0; i < n; i++) {
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBpLCBwb3NpdGlvbiwgbmV3VmFsdWU7CiAgICBwcmludGYoIkVudGVyIHRoZSBzaXplIG9mIHRoZSBhcnJheTogIik7CiAgICBzY2FuZigiJWQiLCAmbik7CgogICAgaW50IGFycltuXTsKICAgIHByaW50ZigiRW50ZXIgJWQgZWxlbWVudHMgb2YgdGhlIGFycmF5OlxuIiwgbik7CiAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgc2NhbmYoIiVkIiwgJmFycltpXSk7CiAgICB9CgogICAgcHJpbnRmKCJFbnRlciB0aGUgcG9zaXRpb24gdG8gcmVwbGFjZSAoMSB0byAlZCk6ICIsIG4pOwogICAgc2NhbmYoIiVkIiwgJnBvc2l0aW9uKTsKCiAgICBpZiAocG9zaXRpb24gPCAxIHx8IHBvc2l0aW9uID4gbikgewogICAgICAgIHByaW50ZigiSW52YWxpZCBwb3NpdGlvbiFcbiIpOwogICAgICAgIHJldHVybiAxOwogICAgfQoKICAgIHByaW50ZigiRW50ZXIgdGhlIG5ldyB2YWx1ZTogIik7CiAgICBzY2FuZigiJWQiLCAmbmV3VmFsdWUpOwoKICAgIC8vIFJlcGxhY2UgdGhlIHZhbHVlCiAgICBhcnJbcG9zaXRpb24gLSAxXSA9IG5ld1ZhbHVlOwoKICAgIHByaW50ZigiVXBkYXRlZCBhcnJheTpcbiIpOwogICAgZm9yIChpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIHByaW50ZigiJWQgIiwgYXJyW2ldKTsKICAgIH0KICAgIHByaW50ZigiXG4iKTsKCn0K