0

Please I have an issue with my java array it's not running

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int[] sides = new int[length]; for (int i = 0; i < length; i++) { sides[i] = scanner.nextInt(); System.out.println(sides[i]*sides[i]); }{} //your code goes here } }

23rd Jan 2023, 10:54 AM
Chinaza Augustine Ijomah
5 Answers
+ 2
Code is running fine. Do you getting any error? What is that? {} after loop is unnecessary. No use. But it don't make any problem...
23rd Jan 2023, 11:04 AM
Jayakrishna šŸ‡®šŸ‡³
+ 3
This looks like it is from a task. Can you add the task description?
23rd Jan 2023, 3:46 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Chinaza Augustine It will better to add error details. I guess, you are having trouble in executing code here. While you run the code, in the pop-up window add all required inputs by code separated space or by line by line. For your code : give inputs like <length> <length number of inputs> Ex: 2 <press enter> 12 <press enter> 13 <press submit> Or 2 12 13 <submit>
24th Jan 2023, 1:06 PM
Jayakrishna šŸ‡®šŸ‡³
0
Any help
23rd Jan 2023, 10:54 AM
Chinaza Augustine Ijomah
0
I get errors while running
24th Jan 2023, 10:16 AM
Chinaza Augustine Ijomah