TOPIC
1197-Volta à Faculdade de Física
LFCL10 asked 2 years ago
import java.io.IOException; import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int v, t, s=0, double_S;
Scanner in = new Scanner(System.in);
while ((v = inputLine(in.next())) != -1) {
if ((t = inputLine(in.next()))!=-1){
s = v * t;
double_S = s * 2;
System.out.print(double_S+"\n");
}else{
break;
}
}
}
static int inputLine(String inputString) {
int inputInt = -1;
Scanner in = new Scanner(System.in);
if (!inputString.equals("EOF")){
inputInt = Integer.parseInt(inputString);
}
return inputInt;
}
}
This topic was solved and cannot recieve new replies.