Forums Register Login

prime numbers

+Pie Number of slices to send: Send
I need to write a program that finds the prime numbers between 1 and 50, but I'm not quite sure how to do it. I know that an even number is prime if it is two, and an odd is prime if it isn't divisible by any of the odd integers less than the square root of the number. Should I be using a for loop? How should I start it off?
+Pie Number of slices to send: Send
Hello,
I'm sorry my English is very bad, but here is a possible solution :
package Uebungen.Methoden;
import ntb.*;
public class U2{

// code removed by Marilyn
}
I hope i can help you with this...
Manu
[ November 03, 2003: Message edited by: Marilyn de Queiroz ]
+Pie Number of slices to send: Send
There is someone else here doing the exact same homework assignment. I would suggest you find that thread and check out what people have alreay said on this subject.
+Pie Number of slices to send: Send
I'm confused. You posted all this code and now you are not posting any code and are asking the question like you haven't done anywork, yet, on the problem.
The best way of getting good answers around here is to post some code and poeple can help you out with it.
+Pie Number of slices to send: Send
I'm confused too. I think I am going to ask that this thread be removed for 2 reasons. You have already asked this question and recieved some answers. Second, grr frr, while trying to help, has violated one of Javaranch's prime directives. And that is not just handing the answers over to people trying to get their homework completed.
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


Reply locked
This thread has been viewed 1054 times.
Similar Threads
Average age of Ranchers
generating numbers from 1 to 100 to store in an array
[medium]Challenge the mathematicians
the world's smallest number?
So just how MUCH must they know?
counting and primes
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:50:15.