Skip to content

Commit

Permalink
checking prime number
Browse files Browse the repository at this point in the history
  • Loading branch information
suhanigupta23 authored Dec 29, 2023
1 parent 0301d6b commit ad1de18
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions primecheck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import java.util.*;

public class Main
{

public static void main(String[] args)
{
Scanner scn = new Scannner(System.in);
int t=scn.nextInt();

for(;t>0;t--)
{
int n =scn.nextInt();

int count=0;
for(int i=1;i<=n;i++)
{
if(n%i==0)
count++;
}

if(count==2)
{
System.out.print ("prime");
}
else
{
System.out.println ("not prime");
}

}
}
}

0 comments on commit ad1de18

Please sign in to comment.