Created
July 22, 2013 04:14
-
-
Save shikajiro/6051250 to your computer and use it in GitHub Desktop.
for文で初期化
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Homework { | |
public static void main(String[] args) { | |
int[] array = new int[30]; | |
for (int i = 0; i < 30; i++) { | |
array[i] = i + 1; | |
} | |
int total = 0; | |
for (int i = 0; i < array.length; i++) { | |
total += array[i]; | |
} | |
System.out.println("合計は" + total + "です"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment