Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
/**
* Created by iyasuwatts on 10/17/17.
*/
import java.util.Scanner;

public class Main {

public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Please input an integer for me to add");
int number = input.nextInt();
System.out.println("The sum of all integers between 1 and " + number + " is: \n" + quickMaffs(number));
System.out.println("Quick Maffs");

}

public static int quickMaffs (int number){
int answer = 0;
for (int i = 1; i <= number; i++){
answer = answer +i;
}
return answer;
}
}