问答题
编写程序。计算S=1+3+5+7+…+99,输出S的值。(要求使用循环结构)
【正确答案】
【答案解析】
#include<stdio.h>
main______
{
int s=0, i;
for(i=1, i<=99; i=i+2)
s=s+i;
printf("1+3+5+7+…99的值为d%", s);
}
提交答案
关闭