i failed at something

This commit is contained in:
vala 2019-12-02 19:12:34 +01:00
parent 32094afe55
commit 80146fc041

View File

@ -1,12 +1,25 @@
import java.io.File;
import java.io.FileNotFoundExeption;
import java.util.Scanner;
public class FuelFinder{ public class FuelFinder{
public static void main(string[] vala){ public static void main(String[] vala){
int[] tVals ={12,14,1969,100756}; File file = new File("input.txt");
for (int a:tVals){ try {
System.out.println("FuelNeeded(a)"); 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){ public static int FuelNeeded(int inp){
return ((inp/3)*2); return ((inp/3)-2);
} }
} }