Cod sursa(job #2596565)

Utilizator andrei_ion.micutMicut Andrei andrei_ion.micut Data 9 aprilie 2020 21:47:35
Problema A+B Scor 0
Compilator java Status done
Runda Arhiva de probleme Marime 0.87 kb
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();
	}
}