Pagini recente » Cod sursa (job #2270375) | Cod sursa (job #846014) | Cod sursa (job #3275325) | Cod sursa (job #2621667) | Cod sursa (job #1487489)
package ab;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
public class APlusB {
public static void main(String[] args) throws IOException {
byte[] bytes = Files.readAllBytes(Paths.get("adunare.in"));
String textFile = new String(bytes, StandardCharsets.UTF_8);
String lines[] = textFile.split("\\r?\\n");
int result = Integer.parseInt(lines[0]) + Integer.parseInt(lines[1]);
FileOutputStream test = new FileOutputStream("adunare.out");
test.write(result);
test.flush();
test.close();
}
}