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

王林
Release: 2020-02-05 10:17:36
Original
35324 people have browsed it

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); }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!