使用while循环,实现 1~100 求和。
#include <stdio.h> int main() { int a=0,s=0; while(a<=100){ s=s+a; a=a+1; } printf("1~100的和为:%d\n",s); return 0; }
posted on 2023-05-17 20:53 wessf 阅读(68) 评论(0) 收藏 举报