kedaOJ#P0017. [NOIP2011普及组] 数字反转

题目#P0017. [NOIP2011普及组] 数字反转

思路

代码

#include <stdio.h>
int main() {
	int x, s = 0;
	scanf("%d", &x);
	if (x < 0) {
		printf("-");
		x = x * (-1);
	}
	while (x > 0) {
		s = s * 10 + x % 10;
		x = x / 10;
	}
	printf("%d", s);
	return 0;
}
posted @ 2024-06-17 19:56  mcr130102  阅读(8)  评论(0编辑  收藏  举报
请不要抄袭任何人的博客,这是对一名开发者最基本的尊重。