Java 实例 - 数字求和运算

Java 教程 · 2019-02-11 11:42:45

以下实例演示了使用do...while结构求0~100的整数数字之和:

Main.java 文件

public class Main { public static void main(String[] args) { int limit=100; int sum=0; int i=1; do { sum=sum+i; i++; } while(i<=limit); System.out.println("sum="+sum); } }

以上代码运行输出结果为:

sum=5050

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

The Definitive Guide to MongoDB

The Definitive Guide to MongoDB

Peter Membrey、Wouter Thielen / Apress / 2010-08-26 / USD 44.99

MongoDB, a cross-platform NoSQL database, is the fastest-growing new database in the world. MongoDB provides a rich document orientated structure with dynamic queries that you’ll recognize from RDMBS ......一起来看看 《The Definitive Guide to MongoDB》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具