//Ques. 1 WAP to find out whether the number is prime or not ?

importjava.util.Scanner;
class prime
{
public static void ...
OUTPUT :-
Upcoming SlideShare
Loading in …5
×

WAP to find out whether the number is prime or not in java

638 views
401 views

Published on

WAP to find out whether the number is prime or not in java

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
638
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

WAP to find out whether the number is prime or not in java

  1. 1. //Ques. 1 WAP to find out whether the number is prime or not ? importjava.util.Scanner; class prime { public static void main(String arr[]) { intn,c=1,i=2; Scanner in = new Scanner(System.in); System.out.print("n Enter a Number = "); n = in.nextInt(); for (i=2;i<=2;i++) { if (n%2==0||n%3==0) { c=0; break; } } if (c==1) System.out.println( n+ " is Prime Number"); else System.out.println(n+ " is not a Prime Number"); } }
  2. 2. OUTPUT :-

×