(Summation of a series) Write a program that displays the result of
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9.
Answer
/**
Program - 06
(Summation of a series)
Write a program that displays the result of
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
**/
public class HelloWorld
{
public static void main(String args[])
{
System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9);
}
}
OUTPUT
45
If you have any doubts or questions, please let me know.