this is my code, when i compile palindrome is not working. even it is palindormg
ID: 3540088 • Letter: T
Question
this is my code, when i compile palindrome is not working. even it is palindormg suppose to be out yes but output is no even it is palindrome #include #include #include #include using namespace std; float powerFuction(float n, int x); bool isMember(int[],int,int); void tableOfSquares (int n) { if(n==0) { return; } if(n>0) { cout<<" "< l){ list::iterator it = l.begin(); int max = *it; it++; for(int i = 1; i < l.size(); i++){ if(max < *it){ max = *it; } it++; } return max; } int main() { float m=2; int n=5; float result; int size=5; int array[]={1,2,3,4,5}; int x=4; int y=6; int answer; cout<<"Table of Squares:"< l; l.push_back(10); l.push_back(101); l.push_back(11); l.push_back(9); l.push_back(100); cout<Explanation / Answer
here ur program with recursion ...
#include <stdio.h>
#include<conio.h>
int palindrome(int n,int rev);
int rem;
void main()
{
int n,reverse,rev=0;
printf("Enter an integer: ");
scanf("%d", &n);
reverse=palindrome(n,rev) ;
/* Checking if number entered by user and it's reverse number is equal. */
if(reverse==n)
printf("%d is a palindrome.",n);
else
printf("%d is not a palindrome.",n);
getch();
}
int palindrome(int n,int rev)
{
if(n!=0)
{
rem=n%10;
rev=(rev*10)+rem;
n/=10;
palindrome(n,rev);
}
else
return rev;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.