#primenumbers | #javatutorails | #javapracticeproblems
Hi guys,
In this video, we will learn how to check if a number is prime or not.
Let's understand what is a prime number and non-prime number
prime number - a number only divisible by 1 and itself
non-prime number - if divisible by any other number apart from 1 and itself
Algorithm/Logic
// 1. input number from the user
// 2. check divisiblity by other numbers - iterate a for loop - 2 to input/2
// 3. condition to check divisiblity using %
// 4. set a flag as false
// 5. if it is divisible print not prime; break the loop; and set flag to true
// 6. after loop completes check if flag is still false. if flag is fase print prime
Stay tuned for more practice problems
Conditional Statements In Java | if else In Java| Nested if | Java Tutorials | Code Bode - • Conditional Statements In Java | if e...
Conditional Statements In Java| Switch In Java| Java Tutorials | Code Bode - • Conditional Statements In Java| Switc...
For Loop In Java | Loops In Java | Java Tutorials | Code Bode - • For Loop In Java | Loops In Java | Ja...
Do While Loops In Java | Difference Between While and Do While | Java Tutorials | Code Bode - • Do While Loops In Java | Difference B...
Break Statement In Java | Uses of Break | Java Tutorials | Code Bode - • Break Statement In Java | Uses of Bre...
Continue Statements In Java | Loops In Java | Java Tutorials | Code Bode - • Continue Statements In Java | Loops I...
Follow Us on Instagram : code.bode
Nesta página do site você pode assistir ao vídeo on-line Java Program To Check Prime Numbers | Print Prime Numbers | Java Practice Problems | Code Bode duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário CodeBode 19 Maio 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,317 vezes e gostou 24 espectadores. Boa visualização!