0
Please explain to me, I don't understand. what means is a first "for"
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(); } for(int t : sides){ System.out.println(t*t); } } }
3 Respostas
+ 2
In the first for-loop we get user input. The user input is filled in the sides array
- 1
in your code first 'for()' is
for (int i = 0; i < length; i++) {