Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Prime or Not
import java.io.*; import java.util.Scanner; class Rextester { public static void main(String[] args)throws IOException { Scanner sc =new Scanner(System.in); System.out.println("Enter a Number"); int n= sc.nextInt(); int s=0; for (int i=1;i<=n;i++) { if (n%i==0) { s++; } } if (s==2) {System.out.println("Prime number it is "+n); } else {System.out.println("Prime number it is not "+n); } } }
run
|
edit
|
history
|
help
0
1st
Java tree
kkk
Loop from 5 to 15
contoh 43
Fibonacci number 0 - 93
om using stars
Vasanth Selvaraj
ChangePI
anonymous abstract class