**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