From 80146fc041d0333901f94e1558a7ba100d8f917e Mon Sep 17 00:00:00 2001 From: vala Date: Mon, 2 Dec 2019 19:12:34 +0100 Subject: [PATCH] i failed at something --- advent-of-code/01/FuelFinder.java | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/advent-of-code/01/FuelFinder.java b/advent-of-code/01/FuelFinder.java index 3a90f43..66e5d5f 100644 --- a/advent-of-code/01/FuelFinder.java +++ b/advent-of-code/01/FuelFinder.java @@ -1,12 +1,25 @@ +import java.io.File; +import java.io.FileNotFoundExeption; +import java.util.Scanner; + public class FuelFinder{ - public static void main(string[] vala){ - int[] tVals ={12,14,1969,100756}; - for (int a:tVals){ - System.out.println("FuelNeeded(a)"); + public static void main(String[] vala){ + File file = new File("input.txt"); + try { + Scanner sc = new Scanner(file); + while (sc.hasNextLine()) { + int i = sc.nextInt(); + System.out.println(i); + } + sc.close(); + } + catch (FileNotFoundException e) { + e.printStackTrace(); } } + public static int FuelNeeded(int inp){ - return ((inp/3)*2); + return ((inp/3)-2); } }