(Even Palindrome number)


PHOTO EMBED

Mon Nov 09 2020 07:53:26 GMT+0000 (UTC)

Saved by @mahmoud hussein #c++

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;
bool isEven(int number);
bool isPalindrom(int number);

int main()
{
	
	int count = 0, number = 1;
	
	while (count <= 50)
	{

		if(isEven(number) == true && isPalindrom(number) == true)
		{
			count++;
			if (count % 5 == 0)
				cout << setw(8) << number << endl;
			else
				cout << setw(8) << number;
		}
		number++;
	}
	
		
	

}

bool isEven(int number)
{
	if (number % 2 == 0)
		return true;
	else
		return false;
	
}
bool isPalindrom(int number)
{
	int reverse = 0, rem = 0;
	int num = number;
	while (number != 0)
	{
		rem = number % 10;
		reverse = reverse * 10 + rem;
		number /= 10;
	}
	if (reverse == num)
		return true;
	else
		return false;
}


	
   




content_copyCOPY

http://cpp.sh/