码迷,mamicode.com
首页 > 其他好文 > 详细

while

时间:2019-12-04 23:34:29      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:sys   没有   class   布尔   ati   自身   print   bsp   while   

使用while循环输出1-10

int i=1;

while(i<=10)

{

  System.out.println(i);

  i++;

}

 

do{

循环体;

}while(布尔表达式);

 

 

 

public class ForTest06
{
//除它自身和1以外没有其他除数。
public static void main(String[] agrs){

int i=1;
while(i <=10){
System.out.println(i);
i++;
}

int j=10;
while(j >1){
System.out.println(j--);

}
int x=1;
do{
x++;
System.out.println(x);
}while(x<=5);

}
}

while

标签:sys   没有   class   布尔   ati   自身   print   bsp   while   

原文地址:https://www.cnblogs.com/god1/p/11986426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!