answersLogoWhite

0

public class Primes {

public static void main(String[] args) {

for(int i = 2; i < 100; i++) {

if(isPrime(i)) {

System.out.println(i);

}

}

}

public static boolean isPrime(int n) {

if(n 0) return false;

}

return true;

}

}

}

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor

Add your answer:

Earn +20 pts
Q: Without array Java code to print prime numbers from 1 to 100?
Write your answer...
Submit
Still have questions?
magnify glass
imp