Several ways to use while loop to calculate and print the sum of even numbers from 2 to 100

一个新手
Release: 2017-09-21 09:40:13
Original
4131 people have browsed it

Use while loop to calculate and print the sum of even numbers from 2 to 100 (three methods)

1. Loop—while
Syntax: while (condition) {

//Loop body-loop operation//Update loop conditions++/--;

}

##2.continue
Function: Terminate the execution of this cycle and continue the next cycle





Document







Copy after login

The above is the detailed content of Several ways to use while loop to calculate and print the sum of even numbers from 2 to 100. 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!