C语言小白求助!!!!!!!!!!!!!!

weixin_45906870 weixin_45906870 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
{
int n_odd = 0;
int n_even = 0;
int sum_odd = 0;
int sum_even = 0;
int input = 0;

printf("Please enter integer to be analyzed(0 to terminate):");
while (scanf_s("%d", &input)) //这里的scanf函数是什么意思?为什么可以这样用?
{
if (0 == input)
{
break;
}
else if (0 == (input % 2))
{
n_even++;
sum_even += input;
}
else
{
n_odd++;
sum_odd += input;
}
}

printf("the average value of %d even is: %f; the average value of %d odd is: %f\n", n_even, (float)(sum_even/n_even), n_odd, (float)(sum_odd/n_odd));

return;

}
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
weixin_45906870
C语言 70,039 成员 243,237 内容