Main.java 450B

123456789101112131415161718192021222324
  1. import java.util.*;
  2. /**
  3. * Created by iyasuwatts on 10/17/17.
  4. */
  5. public class Main {
  6. public static void main(String[] args){
  7. }
  8. public void sumNum() {
  9. Scanner input = new Scanner(System.in);
  10. System.out.println("Type a whole number please:");
  11. int n = input.nextInt();
  12. int value = 0;
  13. for (int i=1; i<=n; i++)
  14. {
  15. value += i;
  16. }
  17. System.out.println(value);
  18. }}