SumofInput.java 495B

12345678910111213141516171819202122232425
  1. import java.util.Scanner;
  2. /**
  3. * Created by iyasuwatts on 10/17/17.
  4. */
  5. public class SumofInput {
  6. public static void main(String[] args){
  7. }
  8. public void enterNumber() {
  9. Scanner input = new Scanner(System.in);
  10. System.out.println("Please enter a number");
  11. int n = input.nextInt();
  12. int prompt = 0;
  13. for(int i = 1; i <= n; i++) {
  14. prompt = i + prompt;
  15. }
  16. System.out.println("Your number is " + prompt + "!");
  17. }
  18. }