fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n=2025,cnt=0,b,j,d,i;
  7. for(i=1;i<=n;i++){
  8. j=i;
  9. b=j%10;
  10. while(j>0){
  11. d=j%10;
  12. j=j/10;
  13. if(b!=d) break;
  14. if(j==0) {
  15. cnt++;
  16. cout<<i<<"\n";
  17. }
  18. }
  19. }
  20. cout<<cnt;
  21. return 0;
  22. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7
8
9
11
22
33
44
55
66
77
88
99
111
222
333
444
555
666
777
888
999
1111
28