网站子站怎么做、南宁建站热搜
news/
2025/10/3 13:43:37/
文章来源:
网站子站怎么做、,南宁建站热搜,做网站后端要学什么,wordpress实现说说链接#xff1a;zoj 1115 或 hdoj 1013 或poj 1519
虽说是水题#xff0c;却几经波折才搞定。该题目中的数字可能非常大#xff0c;所以不能使用整型数#xff0c;只能采用字符变量
代码如下#xff1a;
#include stdio.hint digitalRoot(int n);
int digitS…链接zoj 1115 或 hdoj 1013 或poj 1519
虽说是水题却几经波折才搞定。该题目中的数字可能非常大所以不能使用整型数只能采用字符变量
代码如下
#include stdio.hint digitalRoot(int n);
int digitSum(int n);int main(void)
{char c;int sum;while( (c getchar()) ! EOF){if(c 0)break;sum 0;while(c ! \n c ! EOF){sum c - 0; c getchar();}printf(%d\n,digitalRoot(sum));if( c EOF)break;}return 0;
}
int digitalRoot(int n)
{int sum digitSum(n);while(sum 10)sum digitSum(sum);return sum;
}
int digitSum(int n)
{int sum;for(sum 0; n 0; n / 10)sum n % 10;return sum;
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/925963.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!