From cd5bb74370637e4c3556ba5465e0573498ee9a27 Mon Sep 17 00:00:00 2001 From: johanah29 <49673066+johanah29@users.noreply.github.com> Date: Wed, 29 Sep 2021 16:24:56 +0300 Subject: [PATCH] Add files via upload --- fichier.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 fichier.java diff --git a/fichier.java b/fichier.java new file mode 100644 index 0000000..f56c168 --- /dev/null +++ b/fichier.java @@ -0,0 +1,22 @@ +public class Main { + + public static void main(String[] args) { + + int num = 29; + boolean flag = false; + for (int i = 2; i <= num / 2; ++i) { + // condition for nonprime number + if (num % i == 0) { + flag = true; + break; + } + } + + if (!flag) + System.out.println(num + " is a prime number."); + else + System.out.println(num + " is not a prime number."); + } + + //commit +} \ No newline at end of file