class While05{
public static void main(String[ ]args){
//练习1:使用while循环完成输出1------10中的每个数
/*int i =1;
while(i<=10){
System.out.println(i);
i++;
}*/
}
} class While06{
public static void main(String[ ]args){
//练习2:使用while循环完成输出所有的两位数
int i =10;
while(i<=99){
if(i %2 !=0){
System.out.println(i);
}
i++;
}
//练习3:使用while循环完成输出50---100范围内所有的奇数 //练习3:
//第一种方法:
/*int i = 51;
while(i<=100){
System.out.println(i);
i +=2;
}*/ //第二种方法:
/*int i = 51;
while(i <=100){
if(i %2 !=0){
System.out.println(i);
}
i++;
}*/
}
} class While07{
public static void main(String[ ]args){
//练习4:使用while循环完成输出所有三位数中能被4整除的数,并且每行显示5个 int i = 100,count = 0;
while(i <=999){
if(i % 4 == 0){
System.out.print(i + "\t");
count ++;
}
i++;
if(count % 5 ==0){
System.out.println();
}
}
}
}

while循环案例的更多相关文章

  1. for循环案例

    for循环案例 今天给大家介绍点for循环的案例 1.大马驮2石粮食,中马驮1石粮食,两头小马驮一石粮食,要用100匹马,驮100石粮食,该如何调配? <!DOCTYPE html> &l ...

  2. c语言运算符优先级与while循环案例

    sizeof可以获取数据类型的内存中的大小(字节) #include <stdio.h> #include <stdlib.h> // standared 标准 // inpu ...

  3. js中的for循环案例

    打印99乘法表 for(var x=1; x<=9; x++) {         for(var y=1; y<=x; y++) { document.write(y+"*&q ...

  4. python while循环案例

    1.while循环语句基本结构? while condition: loop body 2.利用while语句写出猜大小的游戏: 设定一个理想数字比如:66,让用户输入数字,如果比66大,则显示猜测的 ...

  5. c语言循环案例

    do while #include <stdio.h> #include <stdlib.h> int main() { int a = 1,b = 10; do { b -= ...

  6. For循环案例练习一基础版

    输出1-10之间的数据 1 public class LX1 { 2 public static void main(String[] args) { 3 for (int x=1;x<=10; ...

  7. For循环案例---九九乘法表

    概述:先创建一个Print99类,类中创建5个方法,分别为Test9901.Test9902.Test9903.Test9904.Test9905,分别打印出不同形状的九九乘法表,该类创建完成后再创建 ...

  8. Javascript-for循环案例-打印1-100之间所有的数字

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  9. 写多个物件css3循环动画案例原理

    div { background-color: #67CF22; height: 100%; width: 6px; display: inline-block; -webkit-animation: ...

随机推荐

  1. this关键字剖析

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. XE中rectangle实现渐变

    Fill -> Kind -> Gradient(选项) -> Gradient(Edit) 添加颜色即可

  3. android 优秀图表库之MPAndroidChart

    MPAndroidChart 1.在项目当中很多时候要对数据进行分析就要用到图表,在gitHub上有很多优秀的图表开源库,这里就简单介绍一下MPAndroidChart. 他可以实现图表的拖动,3D, ...

  4. Android getDimension,getDimensionPixelOffset,getDimensionPixelSize

    1.例如在onMeasure(int , int)方法中可能要获取自定义属性的值.如: TypedArray a = context.obtainStyledAttributes(attrs, R.s ...

  5. SharePoint 2013备份方法整理

    关于SharePoint备份 SharePoint的备份是一个数据副本,主要用于在系统出现故障后还原和恢复该数据. 备份的工具主要有以下几种(写的不全,欢迎补充.) SharePoint管理中心的备份 ...

  6. Django-项目上线后,静态文件配置失效以及404、500页面的全局配置

    https://blog.csdn.net/Jamin2018/article/details/79060509 https://www.cnblogs.com/lfoder/p/6013142.ht ...

  7. 去你妹的DDD 又在误人子弟!

    这种模式只会让人绕弯路 什么聚合根, 什么仓储 ! 实现这些有个J8用? EF本身就是仓储模式 你说是为了切换不同数据库吧 统一事物?我TM 用Sqsugar一样能平滑切换和统一事物,  还不用改代码 ...

  8. WinForm中的多线程

    使用BeginInvoke或Invoke 作用 在自己创建的非UI线程中,进行UI操作,比如更新UI上控件的状态. Windows 窗体中的控件被绑定到特定的线程,不具备线程安全性.因此,如果从另一个 ...

  9. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'blog.t_blog.addTime' which is not functi

    sql报错: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT ...

  10. kali linux之被动信息收集recon-ng

    开源的全特性的web侦查框架,基于python开发 命令格式与msf一致 使用方法:模块,数据库,报告 -h 帮助信息 -v 版本信息 -w 进入工作区,如果没有此工作区,则创建该工作区 -r 批量的 ...