004-004-003
Array Value Assignment: Element Update
Easy
Problem Description
Array Value Assignment: Element Update
Learning Objective: Understand how to assign values to array elements
Input 3 integers, store in array, update a specific element, and output all elements.
Input
Line 1: First value
Line 2: Second value
Line 3: Third value
Line 4: Index to update (0-2)
Line 5: New value
Output
Before: [v1] [v2] [v3]
After: [v1'] [v2'] [v3']
```java
## Example
Input:
```java
10
20
30
1
99
```java
Output:
```java
Before: 10 20 30
After: 10 99 30
Test Cases
※ Output examples follow programming industry standards
Input:
10 20 30 1 99
Expected Output:
Before: 10 20 30 After: 10 99 30
Input:
5 10 15 0 100
Expected Output:
Before: 5 10 15 After: 100 10 15
Input:
1 2 3 2 999
Expected Output:
Before: 1 2 3 After: 1 2 999
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 6 free executions remaining
