import java.util.Scanner; import javax.swing.SwingConstants; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (true) {//just take (true) or (false) System.out.println("hello ahmed"); } } } import java.util.Scanner; import javax.swing.SwingConstants; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 1; while (count <= 5) { System.out.println("HI"); count++; } } } import java.util.Scanner; import javax.swing.SwingConstants; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 1; while (count <= 5) { System.out.println("HI"); ++count; } System.out.println("count = " + count); } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 5; while (count >= 1) { System.out.println("HI"); count--; } System.out.println("count = " + count); } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 5; while (count >= 1) { System.out.println("HI"); count = count - 2;//count-=2 } System.out.println("count = " + count); } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 1; while (count <= 5) { System.out.println("Hi"); // ++count; } } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 1; while (count++ <= 5) { System.out.println("Hi #" + count); // ++count; } } } import java.util.Scanner; public class Mohamed { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 1; while (count++ <= 5) { System.out.println("Hi #" + count); // ++count; } System.out.println("count=" + count); } }
Preview:
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