Home>Article>Backend Development> How to use do...while statement to find the cumulative sum from 1 to 100 in C language

How to use do...while statement to find the cumulative sum from 1 to 100 in C language

王林
王林 Original
2020-02-05 10:17:36 35342browse

How to use do...while statement to find the cumulative sum from 1 to 100 in C language

Requirement: Use do...while statement to find the cumulative sum from 1 to 100

Answer:

(Recommended learning:c language video tutorial)

#include void main() { int sum=0; int i=1; do { sum=sum+i; i++; }while(i<=100); printf("do_while循环结果:%d\n",sum); }

Recommended related article tutorials:c language tutorial

The above is the detailed content of How to use do...while statement to find the cumulative sum from 1 to 100 in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn