Preview:
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // Repetition control statament.
        // for loop.
        int c = 0;
        while (c < 5) {
            System.out.println(c);
            c++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        for (; c < 5;) {
            System.out.println(c);
            c++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 0; c < 5; c++) {
            System.out.println(c);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 0; c < 5; c++) {
            System.out.println(c);
        }
        System.out.println("c==" + c);//error
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        for (; c < 5; c++) {
            System.out.println(c);
        }
        System.out.println("c==" + c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 2; c < 10; c = c + 2) {//c+=2
            System.out.println(c);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 2;
        for (; c < 10; c = c + 2) {
            System.out.println(c);
        }
        System.out.println(c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 1; i < 10 && i % 2 == 0; ++i) {
            System.out.println(i);
            // i++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 10; ++i, ++j) {
            if (i % 2 == 0 && j % 2 == 0) {
                System.out.println(i + " " + j);
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 || j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}



downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter