#include<stdio.h>
#include <stdlib.h>
int main()
{
int a,f=1;
scanf("%d",&a);
for(int i=10;i<=a;i++)
{
int v=i;
while(v>9)
{
if
(abs(v%10-v/10%10)!=1)
{
v=-1;
break;
}
v=v/10;
}
if(v!=-1)
{
printf("%d ",i);
f=0;
}
}
if(f)
printf("-1");
}
Subscribe to:
Posts (Atom)
Just Give Your Feedback ConversionConversion EmoticonEmoticon