DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   java (http://www.daniweb.com/forums/thread79625.html)

aneetasuneel May 30th, 2007 8:54 am
java
 
how to write a program to print first 15 prime nos in java?

Dukane May 30th, 2007 11:10 am
Re: java
 
We will not program your assignments for you. You have to show us some effort before we can help you. Post your code, we can help diagnose some problems. But don't come here expecting us to answer questions without any effort on your part.

To get started, ignore the Java part completely. Just think about what you need to do in order to compute prime numbers. Come up with an "algorithm" of how to do it in your mind.

Then re-write the steps you took in your mind as Java statements. Make this a method in a class (perhaps public static void main). Iterate through the steps enough times until you have 15 of them.

iamthwee May 30th, 2007 4:47 pm
Re: java
 
>how to write a program to print first 15 prime nos in java?
Do something surprising, I dunno maybe try it yourself. No wait. That's just being silly isn't it?

jwenting May 30th, 2007 5:59 pm
Re: java
 
first find out how to print things.
next find 15 prime numbers (that's easy, there's sure to be lists of the thing, so no need to calculate them).

Combine the two and you have your solution.

vinod_javas May 31st, 2007 8:57 am
Re: java
 
better search in google...


All times are GMT -4. The time now is 7:12 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC