Skip to content

Instantly share code, notes, and snippets.

@byt3h3ad
Created April 17, 2020 01:53
Show Gist options
  • Save byt3h3ad/f7c5bdc0dfbb871dec504256f19d2a7f to your computer and use it in GitHub Desktop.
Save byt3h3ad/f7c5bdc0dfbb871dec504256f19d2a7f to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
int main()
{ int num, k=0;
for(int a=1; a<10; a++)
{ for (int b=0;b<10;b++)
{ for (int c=0;c<10;c++)
{ for (int d=0;d<10;d++)
{ for (int e=0; e<10; e++)
{ num = a*10000 + b*1000 +c*100 + d*10 + e;
for(int i=0; i<=5; i++)
{ int p = pow(10, i);
int new = (num - (num % 10*p ))/10 + num % p;
if (new%11 == 0)
std::cout<<new<<" "; k++;
}
}
}
}
}
}
std::cout<<"\n k = "<<k;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment