Pagini recente » Cod sursa (job #816050) | Cod sursa (job #1463125) | Cod sursa (job #304423) | Cod sursa (job #498031) | Cod sursa (job #1268849)
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
// program to find out if the number is symetric
// we need n for number, temp for temporary value to keep n
// and also a variable for divisor
int n, temp, div=1, flag=0;
cout << "Please enter the number " << endl;
cin >> n;
temp = n;
for ( ; temp != 0 ; )
{
div = div * 10;
temp = temp/10;
}
div = div/10;
for( ; div!=0 ; )
{
if( n/div != n%10 )
flag=1;
n = n/10;
div = div/10;
if(div==0)
break;
n = n%div;
div = div/10;
}
if(flag==0)
cout << "yes"<< endl;
else
cout << "no" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}