Pagini recente » Cod sursa (job #764160) | Cod sursa (job #611481) | Cod sursa (job #1082636) | Cod sursa (job #2570820) | Cod sursa (job #2596565)
package Probleme;
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.File;
public class Main {
public void read() throws IOException {
int s = 0;
try {
File myObj = new File("adunare.in");
Scanner myReader = new Scanner(myObj);
int x = myReader.nextInt();
int y = myReader.nextInt();
s = x + y;
System.out.println(s);
myReader.close();
} catch (FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
FileWriter fileWriter = new FileWriter("adunare.out");
PrintWriter pw = new PrintWriter(fileWriter);
pw.print(s);
pw.close();
}
public static void main(String[] args) throws IOException {
Info_Arena1 suma = new Info_Arena1();
suma.read();
}
}