#include<IOSTREAM.h>
main()
{
int rohan=0;
int m=10;
int l=10;
int t=10;
int flag1 =0;
int flag=0;
int temp;
float temp1;
long double n;
double k;
cout<<"ENTER N\n";
cin>>n;
k=n;
int camp;
camp=k;
while (flag1)
{
l*=10;
camp/t;
t*=10;
if (camp == 0)
{flag1=1;}
}
if ((1>n)&&(n>=1e6))
{cout<<"there is a error";}
else
{
while(flag==0)
{
k+=1;
while(l!=m)
{
temp1=k/l;
temp=m*(k/m-k);
m*=10;
l/=10;
if(temp1!=temp)
rohan=0;
else rohan=1;
}
if(rohan==1)
flag=1;
else
flag=0;
}}
if(flag==1)
cout<<"THE PALLINDROME IS "<<k;
else
cout<<"no such pallindrome exists";
return 0;
}
rohan121212
-4
Light Poster
Recommended Answers
Jump to PostFirst off, you should use [code] tags around your code samples in the future. I expect one of the mods will do this for you, but you should not rely on this, if only because it makes extra work for them.
Second, there are a number of issues with …
Jump to Post#include<iostream> using namespace std; int main(){ int rohan=0 , m=10 , l=10 , t=10 , flag1 =0 , flag=0 , temp; float temp1; long double n; double k; cout<<"ENTER N\n"; cin>>n; k=n; int camp; camp=k; while (flag1){ l*=10; camp/t; t*=10; if (camp == 0){ flag1=1; } } …
All 6 Replies
rohan121212
-4
Light Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
AbEeR Q8
1
Newbie Poster
Muhammad Anas
commented:
this is exactly what I wanted to ask when I was looking at the first post of the thread :)
+1
rohan121212
-4
Light Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
morganJohnson
3
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.