This C++ Program Displays all the Products of two 2-digit numbers that are PALLINDROME.
#include <iostream>
using namespace std;
long int pal(long int);
int main()
{
int i,j;
long int num;
cout<<"Pallindrome Products are:\n";
start:
for(i=10; i<100; i++)
{
for(j=10; j<100; j++)
{
num=i*j;
if(pal(num)!=0)
{
cout<<num<<" = "<<i<<" * "<<j;
cout<<endl;
}
}
}
return 0;
}
long int pal(long int x)
{
int rem,tmp,rev=0;
tmp=x;
while(tmp!=0)
{
rem=tmp%10;
tmp/=10;
rev=rev*10+rem;
}
if(x==rev)
return x;
else
return 0;
}
#include <iostream>
using namespace std;
long int pal(long int);
int main()
{
int i,j;
long int num;
cout<<"Pallindrome Products are:\n";
start:
for(i=10; i<100; i++)
{
for(j=10; j<100; j++)
{
num=i*j;
if(pal(num)!=0)
{
cout<<num<<" = "<<i<<" * "<<j;
cout<<endl;
}
}
}
return 0;
}
long int pal(long int x)
{
int rem,tmp,rev=0;
tmp=x;
while(tmp!=0)
{
rem=tmp%10;
tmp/=10;
rev=rev*10+rem;
}
if(x==rev)
return x;
else
return 0;
}