0
Plz help me code project Friend's
Shobha Vadla
8 Answers
+ 6
Specify language and post your attempt.
+ 3
#include <iostream>
using namespace std;
bool isPalindrome(int a)
{
//complete the function
int rev=0,r;
int temp;
temp=a;
bool ans;
while(a>0)
{
r=a%10;
rev=rev*10+r;
a=a/10;
}
if(temp==rev)
{
ans=true;
}
else
{
ans=false;
}
return ans;
}
int main()
{
int n;
cin>>n;
if(isPalindrome(n))
{
cout <<n<<" is a palindrome";
}
else
{
cout << n<<" is NOT a palindrome";
}
return 0;
}
Try this!!
+ 2
Since you didn't specify the language, I can give you the hint.
Use reverse logic and compare the original and reverse value. If it's true then palindrome, else not.
+ 2
You're writing the whole logic in main(). Then what's the use of declaring a function??
+ 1
include <iostream>
using namespace std;
bool isPalindrome(int x) {
//complete the function
}
int main() {
int n; reversedInteger = 0, remainder, originalInteger;
}
cin >>n;
originalInteger = n;
while( n!=0)
{
remainder = n%10; reversedInteger =
reversedInteger* 10 + remainder ; n/= 10;
}
if (originalInteger == revetsedInteger) {
cout <<originalInteger
+ 1
What is in the code any wrong plz tell me
+ 1
Int