0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

繰り返してみるfor.while(学んだこと)

Last updated at Posted at 2022-10-31

for文while文で繰り返してみる

java repeat.java
public class repeat{
    public static void main(String[]args){
        for(int i=1; i<=5; i++){
            System.out.println(i+"回繰り返している(for)");
        }
        int j=1;
        while(j<=5){
            System.out.println(j+"回繰り返している(while)");
               j++;
        }
    }
}

結果

1回繰り返している(for)
2回繰り返している(for)
3回繰り返している(for)
4回繰り返している(for)
5回繰り返している(for)
1回繰り返している(while)
2回繰り返している(while)
3回繰り返している(while)
4回繰り返している(while)
5回繰り返している(while)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?