Question:
Need code (a for loop in java) that will produce the output 1 4 9 16 25 36 49 64 81 100
Code:
public class Loop { public static void main(String[] args) { for(int i=1; i<=10; i++){ System.out.print(i*i + " " ); } System.out.println(""); } }
Output:
$ java Loop 1 4 9 16 25 36 49 64 81 100