ksdf.net
当前位置:首页>>关于用C语言 编程求1+3+5+……+(2n-1).要求用do-while...的资料>>

用C语言 编程求1+3+5+……+(2n-1).要求用do-while...

#include void main() { int n,i=1,sum=0; printf("n = "); scanf("%d",&n); do { sum += (2*i-1); i++; }while(i

第一题#includeint main(void){int i = 1,sum = 0;do{sum = sum + i;i = i + 2;}while(i

#include int main(void) { int i = 0, sum = 0, flag = 0; flag = 1; i = 1; do{ if(1 == flag) { sum += i; flag = 0; } else { sum -= i; flag = 1; } i += 2; }while(i

#include main() { long s,n,k,i; scanf("%d",&n); k=2*n-1; s=0; for(i=1;i

int i=1;int j=0;do{j+=i;i+=2;}while(i

#includevoid main(){ int i,n,s=0,sum=0; printf("input n"); scanf("%d",&n); for(i=1;i

void mian(){ int i=1,sum=0; while(i

用while语句实现: #include using namespace std; int main() { int n,s=0,i; coutn; i=1; while(i

其实差不多的 用for的 #include int main(){ int i, sign=1, sum=0; for(i = 1; i

#include #include int jc(int n) { int i,s=1; for(i=2;i

网站首页 | 网站地图
All rights reserved Powered by www.ksdf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com