Write a Java Program to display all prime numbers in a given range by Mahesh Huddar

  Рет қаралды 26,508

Mahesh Huddar

Mahesh Huddar

Күн бұрын

Пікірлер: 7
@md.sabbirhosen5702
@md.sabbirhosen5702 2 жыл бұрын
Thanks sir, Excellent Explanations but it does not work for 0,1 or any negative numbers! How can it may solved?
@AjayKumar-sg7dd
@AjayKumar-sg7dd 2 жыл бұрын
0 and 1 are not prime numbers.
@kyawkyawaung2362
@kyawkyawaung2362 Жыл бұрын
Firstly, thanks a lot for this excellent explanation!. based on this tutorials, I solved in this way to exclude 0,1 and negative minimum input for my exam and output for primeCount. See the code for your info. public class PrimeNumberBtwStartAndEnd { public static void main(String[] args) { primeCount(10, 30); primeCount(11, 29); primeCount(20, 22); primeCount(1, 1); primeCount(5, 5); primeCount(6, 2); primeCount(-10, 6); } public static void primeCount(int start, int end) { int count = 0, flag = 0; for (int n = start; n
@MrW4gyu
@MrW4gyu Жыл бұрын
Math.abs
@sulaimandanish4561
@sulaimandanish4561 Жыл бұрын
will it work for 2?@@AjayKumar-sg7dd
@gurushinde9694
@gurushinde9694 Жыл бұрын
you can add an if block within the first for loop to check for 0 and 1
@skv292002
@skv292002 6 ай бұрын
How to find range between nth prime number positions
Java Program #6 -  Find Prime Numbers in Java
8:49
Programming For Beginners
Рет қаралды 17 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
L3. Check if a Number if Prime or not | Maths Playlist
7:10
take U forward
Рет қаралды 50 М.
Java Program to find Prime Numbers Between 1 to 100
11:25
learnprograming byluckysir
Рет қаралды 37 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 628 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН