(Summation of a series) Write a program that displays the result of
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9.
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9.
public class Exercise_06 { public static void main(String[] args) { int answer = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9; System.out.println("1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = " + answer); } }
No comments :
Post a Comment