Pagini recente » Cod sursa (job #359222) | Cod sursa (job #1604815) | Cod sursa (job #1654933) | Cod sursa (job #2308132) | Cod sursa (job #2186921)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author elev
*/
public class adunare {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc= new Scanner("adunare.in");
int a, b;
try {
if(!Files.exists(Paths.get("adunare.out")))
{
Files.createFile(Paths.get("adunare.out"));
}
PrintWriter pw = new PrintWriter("adunare.out");
a = sc.nextInt();
b = sc.nextInt();
pw.append(Integer.toString(a + b));
} catch (FileNotFoundException ex) {
System.out.println("Ba tarane nu ti-am gasit fisieru");
} catch (IOException ex) {
System.out.println("Cacat ca nu mere!");
}
}
}