Advertisement
Paarzivall

Untitled

Mar 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.io.PrintWriter;
  4. import java.util.Scanner;
  5.  
  6. public class kloodL2_A {
  7.  
  8.     public static void main(String[] args) throws FileNotFoundException {
  9.         File inFile1 = new File("A.dat");
  10.         File inFile2 = new File("B.dat");
  11.         PrintWriter outFile = new PrintWriter("C.dat");
  12.        
  13.         Scanner sc1 = new Scanner(inFile1);
  14.         Scanner sc2 = new Scanner(inFile2);
  15.        
  16.        
  17.        
  18.         while(sc1.hasNext() && sc2.hasNext()) {
  19.             int a = sc1.nextInt();
  20.             int b = sc2.nextInt();
  21.             int suma = a + b;
  22.             outFile.println(suma);
  23.         }
  24.         outFile.close();
  25.         sc1.close();
  26.         sc2.close();
  27.  
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement