Brush title - Blue Bridge Cup BASIC-8 palindrome

Problem Description:

1221 is a very special number, it is read and read from the right as from the left, seeking programming all such four-digit decimal number.

Output formats:

In ascending order of output of four decimal number satisfying the condition.

Programming:

#include<cstdio>

int main() {
	int a,b,c,d;
	for (int i = 1000; i <= 9999; i++) {
		a = i/1000;
		b = i%1000/100;
		c = i%100/10;
		d = i%10;
		if (a == d && b == c) printf("%d\n",i);
	}
	return 0;
}

Analysis: None

Published 17 original articles · won praise 4 · Views 353

Guess you like

Origin blog.csdn.net/qq_42896549/article/details/104331945