WAP to find out whether the number is prime or not in java
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

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

  • 556 views
Uploaded on

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

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

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
556
On Slideshare
556
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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. OUTPUT :-