Created
September 24, 2015 13:01
-
-
Save dheshanm/fee9fab139ab479aefed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package starting.java.tutorials; | |
| import java.util.Scanner; | |
| /** | |
| * Created by dheshan on 9/24/2015. | |
| */ | |
| public class PrimeCheck { | |
| public static void main(String Args[]){ | |
| int number,i=0; | |
| System.out.print("Enter the Number :"); | |
| Scanner in=new Scanner(System.in); | |
| number=in.nextInt(); | |
| for(int n=2;n<number;n++){ | |
| if(number%n==0){ | |
| System.out.println("The number is not a Prime Number"); | |
| i=1; | |
| break; | |
| } | |
| } | |
| if(i==0){ | |
| System.out.println("The number is a Prime Number"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment