+ 1

How can one print prime numbers between 1 and 100 in Java using do while loop

Do while

28th Aug 2018, 6:23 PM
Jaison Chipuka
2 Réponses
+ 2
----------------- algorithm: ---------------- 1. make a method that receives a number and returns true if it is prime, false otherwise; 2. create a do while loop that loops from 1 to 100; 3. use the method created in (1) to check in every iteration if the number is prime, if so print it;
28th Aug 2018, 6:54 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
https://code.sololearn.com/c6yz0DMw8euz/#cpp An algorithm for checking if the number is prime. Hope this helps.
28th Aug 2018, 6:51 PM
Steppenwolf
Steppenwolf - avatar