From 7fb074bc9d8b703239f12a4474a0c26fd5f8b3b8 Mon Sep 17 00:00:00 2001 From: Katrice Williams-Dredden Date: Wed, 7 Feb 2018 22:17:57 -0500 Subject: [PATCH] 'created a loop to run the program' --- src/main/java/Main.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 1dbc0cb..ab7fd58 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,9 +1,25 @@ +import java.util.Scanner; + /** * Created by iyasuwatts on 10/17/17. */ public class Main { public static void main(String[] args){ + /*I added Scanner check to allow the user to input in this particular program. Then I added a print statement + so the user would know they had to type an integer. Created a variable to hold the number they selected. Then + created a holder for the for loop which takes the total and gets the sum based on the last loop through. + */ + Scanner check = new Scanner(System.in); + System.out.println("Enter you number here: "); + int n = check.nextInt(); + + int total = 0; + + for (int i = 1; i <= n; i++){ + total = total + 1; + } + System.out.println(total); } }