From 4712848bf10848c4bda9c956cbbff7b1d1532f3c Mon Sep 17 00:00:00 2001 From: hesham Date: Fri, 1 Mar 2019 17:01:29 +0300 Subject: [PATCH] Lab 6 --- src/lab/six/Five.java | 12 ++++++++++++ src/lab/six/Four.java | 15 +++++++++++++++ src/lab/six/One.java | 11 +++++++++++ src/lab/six/Six.java | 12 ++++++++++++ src/lab/six/Three.java | 25 +++++++++++++++++++++++++ src/lab/six/Two.java | 14 ++++++++++++++ 6 files changed, 89 insertions(+) create mode 100644 src/lab/six/Five.java create mode 100644 src/lab/six/Four.java create mode 100644 src/lab/six/One.java create mode 100644 src/lab/six/Six.java create mode 100644 src/lab/six/Three.java create mode 100644 src/lab/six/Two.java diff --git a/src/lab/six/Five.java b/src/lab/six/Five.java new file mode 100644 index 0000000..5f0c1eb --- /dev/null +++ b/src/lab/six/Five.java @@ -0,0 +1,12 @@ +package lab.six; + +public class Five { + public static void main(String []args){ + for (int i = 1; i<= 10; i++){ + if (i < 6){ + System.out.println(i); + } + else break; + } + } +} diff --git a/src/lab/six/Four.java b/src/lab/six/Four.java new file mode 100644 index 0000000..b3b3fbd --- /dev/null +++ b/src/lab/six/Four.java @@ -0,0 +1,15 @@ +package lab.six; + +public class Four { + public static void main(String []args){ + int i = 1; + int sum = 0; + while (i <= 10 ){ + if (i != 3 && i != 6){ + sum += i; + } + i++; + } + System.out.println(sum); + } +} diff --git a/src/lab/six/One.java b/src/lab/six/One.java new file mode 100644 index 0000000..dc9ce0a --- /dev/null +++ b/src/lab/six/One.java @@ -0,0 +1,11 @@ +package lab.six; + +public class One { + public static void main(String [] args){ + for (int i = 1; i<= 100; i++){ + if (i % 2 != 0){ + System.out.println(i); + } + } + } +} diff --git a/src/lab/six/Six.java b/src/lab/six/Six.java new file mode 100644 index 0000000..d036e5a --- /dev/null +++ b/src/lab/six/Six.java @@ -0,0 +1,12 @@ +package lab.six; + +public class Six { + public static void main(String []args){ + for (int i = 1; i<= 10; i++){ + if (i == 6){ + continue; + } + else System.out.println(i);; + } + } +} diff --git a/src/lab/six/Three.java b/src/lab/six/Three.java new file mode 100644 index 0000000..419ebab --- /dev/null +++ b/src/lab/six/Three.java @@ -0,0 +1,25 @@ +package lab.six; + +public class Three { + public static void main(String []args){ + for (int i = 1; i <= 5; i++){ + switch (i){ + case 1: + System.out.println("A"); + break; + case 2: + System.out.println("B"); + break; + case 3 : + System.out.println("C"); + break; + case 4 : + System.out.println("D"); + break; + case 5: + System.out.println("E"); + break; + } + } + } +} diff --git a/src/lab/six/Two.java b/src/lab/six/Two.java new file mode 100644 index 0000000..ab1fe9c --- /dev/null +++ b/src/lab/six/Two.java @@ -0,0 +1,14 @@ +package lab.six; + +public class Two { + public static void main(String []args){ + + int i = 10; + do { + System.out.println(i); + i--; + } while (i >= 0); + + } + +}