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

  Рет қаралды 21,453

Mahesh Huddar

Mahesh Huddar

2 жыл бұрын

Write a Java Program to display all prime numbers in a given range by Mahesh Huddar
In this video, I will discuss how to display all prime numbers in a given range. For example between 10 to 100.
I will read the range through keyboard, and thencheck all the numbers in the range. If a nuber is prime it will be displayed otherwise number is skipped.
********************************
1. Blog / Website: www.vtupulse.com/
2. Like Facebook Page: / vtupulse
3. Follow us on Instagram: / vtupulse
4. Like, Share, Subscribe, and Don't forget to press the bell ICON for regular updates

Пікірлер: 7
@md.sabbirhosen5702
@md.sabbirhosen5702 Жыл бұрын
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 Жыл бұрын
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 11 ай бұрын
will it work for 2?@@AjayKumar-sg7dd
@gurushinde9694
@gurushinde9694 11 ай бұрын
you can add an if block within the first for loop to check for 0 and 1
@skv292002
@skv292002 Ай бұрын
How to find range between nth prime number positions
Find Prime Numbers In Java - Full Walkthrough with Source
13:17
Coding with John
Рет қаралды 35 М.
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
Каха заблудился в горах
00:57
К-Media
Рет қаралды 10 МЛН
ТЫ С ДРУГОМ В ДЕТСТВЕ😂#shorts
01:00
BATEK_OFFICIAL
Рет қаралды 6 МЛН
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,3 МЛН
Frequently Asked Java Program 10: Generate Fibonacci series
9:50
Java Program #6 -  Find Prime Numbers in Java
8:49
Programming For Beginners
Рет қаралды 7 М.
How to solve any Star Pattern Program
18:47
Simply Coding
Рет қаралды 1,1 МЛН
Program to Print All Prime Numbers between 1 to 100 in Java by Deepak
10:59
Smart Programming
Рет қаралды 383 М.