#include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) { system("pause"); int ge,shi,bai,qian,wan; for(int i=100;i<1000;i++){ ge=i%10; shi=i/10%10; bai=i/100%10; if(ge==bai&&bai+1){ cout<<i<<' '; } } for(int i=1000;i<10000;i++){ ge=i%10; shi=i/10%10; bai=i/100%10; qian=i/1000%10; if(ge==qian&&bai==shi){ cout<<i<<' '; } } for(int i=10000;i<100000;i++){ ge=i%10; shi=i/10%10; bai=i/100%10; qian=i/1000%10; wan=i/10000%10; if(ge==wan&&bai==qian&&bai+1){ cout<<i<<' '; } } return 0; }