Repetition Control Statement (For Loop)
Mon Apr 19 2021 03:16:29 GMT+0000 (Coordinated Universal Time)
Saved by @ahmedqgqgq #java
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);
}
}
}



Comments