Computing.Net > Forums > Programming > Prime Number problem in java

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Prime Number problem in java

Reply to Message Icon

Name: ran
Date: June 28, 2005 at 18:11:19 Pacific
OS: d
CPU/Ram: 128mb ram
Comment:

i have a problem using java to create a program to determine if it is a prime or not. And also a palindrome code. Can you help me with this?


ran



Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: June 28, 2005 at 21:44:29 Pacific
Reply:

Yes, but only if you try it yourself first so we aren't just doing your homework for you. You should do what you can yourself and post a specific problem if you get stuck.

-SN


0

Response Number 2
Name: Ishwar Dhanuka
Date: July 12, 2005 at 23:16:40 Pacific
Reply:

class palindrome
{
public static void main(String[] args)
{
int rem=0,rev=0,n=1561,a=n;
do
{
rem=a%10;
rev=rem+(10*rev);
a/=10;
}
while(a!=0);
if(rev==n)
System.out.println("Yes");
else
System.out.println("No");
}
}


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Prime Number problem in java

keypressed problems in java www.computing.net/answers/programming/keypressed-problems-in-java/17641.html

Help with problem in JAVA... www.computing.net/answers/programming/help-with-problem-in-java/5117.html

random number in java www.computing.net/answers/programming/random-number-in-java/11252.html