LoginSignup
2
2

More than 5 years have passed since last update.

Java_1から100までの総和

Posted at
public class Main {


    public static void main(String[] args) {


        int[] a = java.util.stream.IntStream.rangeClosed(1, 100).toArray();
        int sum = java.util.Arrays.stream(a).sum();


        System.out.println(sum); 
    }


}
//5050

参考

次にやること

Java8の参考書を読む。

あとがき

ストリームに詳しくなりたい。

2
2
3

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
2
2