From 5942e6f6f8ec40dd1b0382648c6fba0ba52d532d Mon Sep 17 00:00:00 2001 From: Devesh Mehara <96515074+MehraDevesh2022@users.noreply.github.com> Date: Tue, 4 Oct 2022 21:39:52 +0530 Subject: [PATCH] prime or not algo added --- algorithms/Java/Maths/check-prim-or-not.java | 21 ------------------- algorithms/Java/Maths/check-prime-or-not.java | 19 +++++++++++++++++ 2 files changed, 19 insertions(+), 21 deletions(-) delete mode 100644 algorithms/Java/Maths/check-prim-or-not.java create mode 100644 algorithms/Java/Maths/check-prime-or-not.java diff --git a/algorithms/Java/Maths/check-prim-or-not.java b/algorithms/Java/Maths/check-prim-or-not.java deleted file mode 100644 index 72d61f2b..00000000 --- a/algorithms/Java/Maths/check-prim-or-not.java +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.*; - -public class Main{ - public static void main(String[] args) { - Scanner scn = new Scanner(System.in); - int num = scn.nextInt(); - boolean ans = isPrime(num); - if(ans =! true) System.out.println("not prime"); - else System.out.println("prime"); - } - - - public static boolean isPrime(int num){ - for(int i=2; i*i