题解 | #数字颠倒#

数字颠倒

https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
#include<string.h>
void Down(char* str)//这里是正常打印 因为是倒置的放置
{
	assert(str != NULL);
	int len = strlen(str);
	for (int i = 0; i < len; i++)
	{
		printf("%c", *(str+i));

	}
}
void Conversion(char str[], int n)//转换到数组里面  初始化数组
{
	int i = 0;
	do
	{
		str[i++] = n % 10 + '0';
		n /= 10;
	} while (n > 0);
}
int main()
{
	int n = 0; 
	char str[1000] = { 0 };
	scanf("%d", &n);
	Conversion(str, n);
	Down(str);
	return 0;
}

全部评论

相关推荐

12-02 20:08
已编辑
门头沟学院 后端工程师
notbeentak...:孩子,说实话,选择很重要,可能你换一个方向会好很多,但是现在时间不太够了,除非准备春招
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务