求C语言大神 用的DEV C++ 急急急!!!!!
答案:1 悬赏:70 手机版
解决时间 2021-04-06 15:53
- 提问者网友:雪舞兮
- 2021-04-06 11:56
求C语言大神 用的DEV C++ 急急急!!!!!
最佳答案
- 五星知识达人网友:纵马山川剑自提
- 2021-04-06 13:26
int sum(int start, int count) {
int num = 0;
int i = 0;
for (i = 0; i < count; ++i) {
num += start + i;
}
return num;
}
int main (void) {
int n = 0;
scanf ("%d", &n);
int i = 0;
int num = 0;
for (i = 1; i <= n; ++i) {
num += sum(i, i+1);
}
printf ("sum=%d", num);
return 0;
}
int num = 0;
int i = 0;
for (i = 0; i < count; ++i) {
num += start + i;
}
return num;
}
int main (void) {
int n = 0;
scanf ("%d", &n);
int i = 0;
int num = 0;
for (i = 1; i <= n; ++i) {
num += sum(i, i+1);
}
printf ("sum=%d", num);
return 0;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯