(Palindrome number) Write a program that prompts the user to enter an integer and uses loops to simplify Programming Exercise 3.36.

PHOTO EMBED

Tue Oct 27 2020 08:04:05 GMT+0000 (UTC)

Saved by @mahmoud hussein #c++

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

using namespace std;

int main()
{
	int num, reversedInteger = 0, remainder, originalInteger;
	cin >> num;
	originalInteger = num;
	for (; num != 0; num /= 10)
	{
		remainder = num % 10;
		reversedInteger = reversedInteger * 10 + remainder;
	}


	if (originalInteger == reversedInteger)
		cout << originalInteger << " is a palindrome.";
	else
		cout << originalInteger << " is not a palindrome.";


	
	

	
	
}

	
	

content_copyCOPY

http://cpp.sh/