Previous Next
0 / 21
Module DEMO-32-106DEMO-C-32

Modify Array Elements

DEMO-C-32 β€’ Programming in C

Browser-only practice

Problem Statement

You are given an array of integers. Your task is to modify specific elements and then print the updated array.

Requirements

  • Read an integer n, representing the size of the array.
  • Read n integers to fill the array.
  • Change the third element (index 2) to 3.
  • Change the fourth element (index 3) to 0.
  • Print each element of the modified array on a new line.

Constraints

n >= 4 Each array element is an integer.

Input Format

  • The first line contains an integer n β€” the size of the array.
  • The second line contains n space-separated integers β€” the elements of the array.

Output Format

Print each element of the modified array on a new line.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
44 55 66 77 88
44
55
3
0
88
Sample #2
Public sample
7
10 20 30 40 50 60 70
10
20
3
0
50
60
70

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings