Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
lads im a total newbie when it comes to java
how do i do a program like this
(1)Prompt the user to enter an integer(2)Determine if the number is a prime number - A number is prime if it is not divisible by any positive integer other than 1 and itself; 1 is not considered to be a prime.. For example, 2, 5, 17, and 4,598,731 are primes, whereas 6 and 35 are not prime. A message should then be output stating whether the number is a prime number or not.
i think i got the first one right about integers
public class assignment
{
public static void main(String[]args)
{System.out.println("Please input an
integer");
hope im right theredo i dont have a clue about the Determine if the number is a prime number - A number is prime etc

Hey!
For my Programming I class, we have to buy this book: http://www.amazon.com/Fundamentals-... In the book, as I read last night, it had the writtened program for getting the prime numbers and also alert user if they had input in the wrong integers!
You can buy this book :)
Or I'll try to take a closer look in the book for the writtened program for you. I can't do it now because I have a program to do.
-KelsI'm only here to get help on programming and such ;

![]() |
Ping unitl reply
|
core specific settings.
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |