bottom-tier-java/advent-of-code/01/FuelFinder.java

26 lignes
475 B
Java
Brut Vue normale Historique

2019-12-02 13:12:34 -05:00
import java.io.File;
2019-12-02 13:14:29 -05:00
import java.io.FileNotFoundException;
2019-12-02 13:12:34 -05:00
import java.util.Scanner;
public class FuelFinder{
2019-12-02 13:12:34 -05:00
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();
2019-12-02 12:43:29 -05:00
}
}
2019-12-02 13:12:34 -05:00
public static int FuelNeeded(int inp){
2019-12-02 13:12:34 -05:00
return ((inp/3)-2);
}
}