王贺


私信TA

用户名:MrSupW

访问量:83612

签 名:

LikeWind

等  级
排  名 15
经  验 21143
参赛次数 1
文章发表 198
年  龄 20
在职情况 学生
学  校 西北工业大学
专  业 软件工程

  自我简介:

What can not destory me only makes me stronger!

 

0.0分

7 人评分

  评论区

#include <stdio.h>

int main(void)
{
	char n[128] = {'\0',};
	int i = 0, m = 0, rem = 0;
	while (EOF != scanf("%s%d", n, &m)) {
		for (i = rem = 0; n[i] != '\0'; ++i) {
			rem = (rem*10+(n[i]-'0'))%m;
		}
		printf("%d\n", rem);
	}
	return (0);
}这样可以不用计算数组长度
2020-03-01 20:41:59
  • «
  • 1
  • »