100的累加和 while 循环

//100的累加和   while 循环

#include <stdio.h>
int main()
{
    int sum = 0;               //5050
    int i = 0;
    while(i < 101)
    {
        sum = sum +i;
        i++;
    }
    printf("%d\n",sum);
}

 

posted on 2021-07-28 12:12  Bytezero!  阅读(165)  评论(0编辑  收藏  举报