**prime number program in java** : we are going to start __prime number program in java using for loop__ with example. So There is provided also __composite numbers__ and __prime numbers from 1 to 100__. After that in this section provide all example Prime number program

## Simple Prime Number Program in Java

```
import java.util.*;
class PrimeNumber
{
public static void main(String args[])
{
int n, status = 1, num = 3, count, j;
Scanner in = new Scanner(System.in);
System.out.println("Enter prime numbers you want");
n = in.nextInt();
if (n >= 1)
{
System.out.println("First "+n+" prime numbers are:");
System.out.println(2);
}
for (count = 2; count <=n;)
{
for (j = 2; j <= Math.sqrt(num); j++)
{
if (num%j == 0)
{
status = 0;
break;
}
}
if (status != 0)
{
System.out.println(num);
count++;
}
status = 1;
num++;
}
}
}
```

## what are prime numbers

And In this article we are going to finding Prime numbers right all the prime number. So till particular given number there is no need to take all the number. After that you just find the square root of the given number. And if that square root is decimal take the next number. As a result, check the desirably of all available number from 1 till that square root of the number. Therefor using the same principle. We are going to find the prime number between 1 and 100 and method. After that We are going to use is celled Eratosthenes Sieve so let me first

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |

31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |

61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |

71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |

81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |

91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 |

## prime numbers from 1 to 100

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |

31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |

61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |

71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |

81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |

91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 |

### How to Find Prime Numbers

In this paragraph This method will be start with from the first row and will go from left to right. And check the desirably of all the number still only 10 why because square root of 100 is 10. So 10*10 give us 100 since 10*10=100 which is the biggest number on this grade. But if you can check desirably of all the numbers till 10 and strike of all the number. Therefor Which are desirable by the numbers till 10 and then will have set of numbers. And create** prime number program in java **

## Prime Number __Composite Numbers__

As a result Which are still meaning all of then will be prime numbers why because 10 get 10*10= 100 largest numbers in the grade. So there is no need check the desirability but 11 12 13 and so on why because 10*11=110. Which is number bigger than 100 and 10*13 is bigger then 100 so in this particular case. And Actually useless the check desirably of all the numbers by another number. Which is bigger then 10. So Will be start pro cigar and then you will understand. Why i saying this and now lets start the pro cigar. First will start the first row and each row will be go from left to right.

The first will take first row then will take second row and since 10 is first row. We are actually not suppose to go to the second row but to the cross check a logic. you will take the element of the second row also will take number 1 by 1 and then we will cross all the multiple. We will start from 1 and 1 is actually special number it is neither classified as prime number nor as a composite number.

## Simple Example to Find __Prime Number__

**Prime Number program in java** : we are going to about 1 after this will go check from left to right and check for the still. There uncross how to number after this 2. Therefor 2 is prime number and then what have to do i have strike to all the number. Thus switch are multiple number of 2 so all the number.

Therefor Which are numbers of 2 will be the even numbers on you can peacefully strike of alternate numbers. And every second number of this number Therefor 2 is a prime number first number after 2. 3 and second number after to 4 so 4 is multiple of 2 similar 6 is multiple number of 2. And 8 is a multiple number of 2 all the even number are multiple of 2. 12 is a multiple number of 2 ,14,16,18 and 20 is multiple of 2.

After that we can all this alternate column then have even number. So 3 is prime number All have to red color shade prime number. Thus All highlight number is prime numbers

HTML Syntax : We have to described simple html tags with all information aslo example create your simple page weblearn go to check ..

Latest International news in hindi go to check world technical News on this website

Great, I really like it! Youre awesome

thanks

great post thanks helpful articles international news in hindi

You could definitely see your expertise in the work you write.

The world hopes for even more passionate writers like you who are not afraid to

mention how they believe. Always go after your heart.

I’m just writing to let you be aware of what a fabulous experience our girl enjoyed reading the blog. She learned a lot of pieces, with the inclusion of what it’s like to possess an amazing coaching spirit to let the others without problems understand a number of tricky subject matter. You actually surpassed our own expectations. Many thanks for coming up with such beneficial, healthy, educational and in addition cool thoughts on this topic to Ethel.

This is very attention-grabbing, You’re an overly skilled blogger.

I have joined your rss feed and look ahead to searching for extra of your magnificent post.

Also, I’ve shared your web site in my social networks

You have remarked very interesting details! ps decent internet site.

thanks

If you are going for most excellent contents like myself,

simply pay a visit this web page all the time since it presents quality contents, thanks

You made some really good points there. I checked on the internet to learn more about the issue and found most

individuals will go along with your views on this site.

Excellent post. I was checking continuously this blog and I am impressed!

Very helpful information particularly the last part 🙂 I care

for such info a lot. I was looking for this particular info for a long time.

Thank you and best of luck.

Closing in on 300! That definitely appeals to me.

Thank you for the auspicious writeup. It in fact was a amusement account it.

Look advanced to more added agreeable from you!

By the way, how could we communicate?

Welcom… do you have any query ask every time

I intended to draft you one very little remark just to give many thanks again for your awesome thoughts you’ve discussed in this case. It’s so seriously generous with you to deliver without restraint exactly what a few individuals might have offered as an e book to end up making some dough for their own end, mostly considering the fact that you could have done it if you ever decided. Those smart ideas also served to be the great way to recognize that other people have a similar interest similar to my own to find out a great deal more pertaining to this problem. I am certain there are numerous more enjoyable occasions up front for folks who take a look at your site.

Welcome and thanks

I definitely wanted to post a brief remark in order to appreciate you for those marvelous techniques you are posting on this website. My long internet research has at the end of the day been rewarded with high-quality suggestions to write about with my good friends. I would mention that we readers actually are truly fortunate to be in a wonderful website with so many marvellous individuals with insightful advice. I feel quite grateful to have discovered the website page and look forward to many more excellent times reading here. Thanks again for everything.

Thanks will be provide relatively it

Thanks so much for providing individuals with an exceptionally remarkable chance to read in detail from this website. It can be very excellent plus stuffed with fun for me personally and my office peers to visit your site at minimum thrice in a week to learn the new guidance you have. Of course, I’m just usually motivated with your remarkable tips and hints you serve. Certain two points in this post are in truth the most suitable we’ve had.

thanks for the post.

I am only writing to let you be aware of of the excellent encounter my cousin’s princess undergone viewing your web site. She came to understand several pieces, which include how it is like to possess an amazing giving style to have other people clearly grasp selected advanced topics. You undoubtedly exceeded our desires. Thank you for producing the effective, trusted, educational and in addition unique tips about the topic to Gloria.