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. bash/shell的字符串trim实现

    #!/bin/sh trim() {     trimmed=$1     trimmed=${trimmed%% }     trimmed=${trimmed## }     echo $trim ...

  2. oracle 中用法dual

    dual是一个虚拟表,用来构成select的语法规则,oracle保证dual里面永远只有一条记录.我们可以用它来做很多事情. dual是一个虚拟表,用来构成select的语法规则,oracle保证d ...

  3. hibernate的获取session的两方法比较,和通过id获取对象的比较,一级缓存二级缓存

    opensession与currentsession的联系与区别 在同一个线程中opensession的session是不一样的,而currentsession获取的session是一样的,这就保证了 ...

  4. U盘安装Ubuntu 12.04成功后系统无法启动的原因及解决办法

    想搭建一个Linux开发环境,选择了ubuntu12.04长期支持版,采用u盘安装(Universal-USB-Installer做的启动),发现安装完成之后,拔掉u盘无法启动,插上u盘之后,可以重启 ...

  5. C#Thread学习

    一.Thread的使用方式 1.不带参数 (1)使用lambda public static void fun1() { Console.WriteLine($"Main ThreadId: ...

  6. [转]Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 6.

    1. Introduction. 1.1 Starting from part 4 I have started to discuss how to interop marshal a managed ...

  7. 如何使用 channel

    如何使用 Channel 例子来自于Concurrency is not parallelism Google Search: A fake framework v1.0 var ( Web = fa ...

  8. sqlServer组合主键

    sqlServer   组合主键 创建表时: create table Person ( Name1 ) not null ,Name2 ) not null primary key(Name1,Na ...

  9. react.js学习之路三

    学习react.js,知识点整理: 1.props和state: props是相对于父级来说,固定的不会改变的内容.一般会先定义一个变量,则在父级中进行引用, var user = "liu ...

  10. 18、OpenCV Python 简单实现一个图片生成(类似抖音生成字母人像)

    __author__ = "WSX" import cv2 as cv import numpy as np def local_threshold(img): #局部阈值 gra ...