Mohan1289
October 6th, 2012, 09:09 AM
Little help i don't understand where the error is..
The Task is
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 http://projecteuler.net/images/symbol_times.gif 99.
Find the largest palindrome made from the product of two 3-digit numbers.
class Prpal
{
public static void main(String[] args)
{
int i,j;
long a,k;
long rev=0;
//Repeating the Loop itself from 999 to 100
for ( i=100; i>1000 ; i-- )
{
// Repeating the loop to multiply i with numbers from 999 to 100 Each time i value is increased
for (j =100; j<i; j++)
{
k=i*j;
// Logic for Reversing The Number
a=k%10;
k=k/10;
rev=rev*10+a;
// Checking weather the given number is palindrome or not??
if (k==rev)
{
System.out.println("The Number "+k+"is Palindrome");
}
}
}
}
}
It is compiling without Errors yet no output is displaying.. :(
I can't understand where the error is....
The Task is
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 http://projecteuler.net/images/symbol_times.gif 99.
Find the largest palindrome made from the product of two 3-digit numbers.
class Prpal
{
public static void main(String[] args)
{
int i,j;
long a,k;
long rev=0;
//Repeating the Loop itself from 999 to 100
for ( i=100; i>1000 ; i-- )
{
// Repeating the loop to multiply i with numbers from 999 to 100 Each time i value is increased
for (j =100; j<i; j++)
{
k=i*j;
// Logic for Reversing The Number
a=k%10;
k=k/10;
rev=rev*10+a;
// Checking weather the given number is palindrome or not??
if (k==rev)
{
System.out.println("The Number "+k+"is Palindrome");
}
}
}
}
}
It is compiling without Errors yet no output is displaying.. :(
I can't understand where the error is....