+ 5

How to write a java program to print prime numbers between 1 to 100 by using for-loop?

16th Oct 2018, 1:24 AM
Malithya Fernando
Malithya Fernando - avatar
4 Respuestas
+ 1
use the mathematical logical to solve Prime number should have only 2 factors. one is theirs vakue and 1.Go ahead on that logic
16th Oct 2018, 3:06 AM
Sahan Dissanayaka
Sahan Dissanayaka - avatar
+ 1
Thank you Sahan and Kuyondo for your reply...😊
16th Oct 2018, 1:38 PM
Malithya Fernando
Malithya Fernando - avatar
0
edit: keyword=use modulus if it gives no remainder, its NOT a prime number.
16th Oct 2018, 1:29 PM
Kuyondo
Kuyondo - avatar
0
sorry mistake i edited my previous answer
16th Oct 2018, 1:36 PM
Kuyondo
Kuyondo - avatar