Question: Write a Java program that will take an integer number (i.e. N ) as an input from the keyboard and show the sum of all
- Write a Java program that will take an integer number (i.e. N ) as an input from the keyboard and show the sum of all integers from to N. ( For example, If user enters 5 then the program will show 5 as an output. 1 + 2 + 3 + 4 + 5 = 15)
- Rewrite the code using a method named as SumOfN (int). The method will take an integer number as its argument and return the summation. Make sure to use METHOD to write the java code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
