#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
En esta página del sitio puede ver el video en línea Java Program To Check Prime Numbers | Print Prime Numbers | Java Practice Problems | Code Bode de Duración hora minuto segunda en buena calidad , que subió el usuario CodeBode 19 mayo 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,317 veces y le gustó 24 a los espectadores. Disfruta viendo!