Answers for "prime no between 1 to 10^6"

5

prime numbers from 1 to 100

// find all numbers prime java
public class IsNumberIsSimple {
       
        public static void main (String args[]) {
        
            for ( int i=0; i < 100; i++) {
              isNumberIsSimple(i);
            }     
        }   
        
        public void isNumberIsSimple(num){
        	for ( int i=2; i < num; i++) {
                  if ( num%i == 0) {
                          return;
                  }      
          	}
          	System.out.println("Very well! It's simple! " + num);   
        }
}

//1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
Posted by: Guest on November-01-2020

Code answers related to "prime no between 1 to 10^6"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language