>
其他
>
编写程序,求1到100之间的奇数之和及偶数之和,并将两者输出
用C语言编写,要用函数
人气:133 ℃ 时间:2020-05-15 23:02:36
解答
解法1:
#include
int F1()
{
return 50*(1+99)/2;
}
int F2()
{
return 50*(2+100)/2;
}
void main()
{
printf("Odd number sum=%d,Even number sum=%d\n",F1(),F2());
}
解法2
#include
int F1()
{
int i,sum=0;
for(i=1;i
推荐
编程计算1-100之间的奇数和与偶数和
编写程序,求1~100之间的奇数和偶数之和,并加以输出.用C语言
1到100以内有多少个奇数和偶数?
1-100中所有偶数的和与奇数的和相差多少
自然数1~100内,偶数有几个 奇数有几个
If your prices are competitive,we will place a large order with you.
I perfer the pink dress to the green one.
写一份英语倡议书,号召大家节约用水
猜你喜欢
怎样判断物质由分子、原子还是离子构成?
Our passport are here.改为倒装句怎么改?
写出反义词或对应词 big一 |ong一 y
为什么冰放在水里会更快融化?
0.9数字大还是0.12数字大
We could not help后面加动词什么形式?
浓度75%的酒精用于灭菌消毒效果最好,配置这种浓度的酒精消毒液,酒精与水的体积比( )
1.完成时一般疑问句的构成____.2.现在完成时否定句的构成:____.3.总结alread和yet的用法:____.
© 2024 79432.Com All Rights Reserved.
电脑版
|
手机版