for (int i=2; i<5; i++) { System.out.println (i); }
public class ForLoopPrint { public static void main (String[] argv) { for (i=0; i<5 i++) { System.out.println (i) } } }
int a=1, b=2, c=3; for (int i=0; i<5; i++) { c = a + b; b = c; } System.out.println (c);
int[] A = {1, -2, 3, 4, -5, 6, -7};should be -14.
int[] A = {1, 2, 3, 4};prints out all possible pairs of elements, with each pair on one line, and where each element in a pair must be different. We'll count the pair 1,2 the same as the pair 2,1. Thus the output for the above will be:
1 2 1 3 1 4 2 3 2 4 3 4