Josif_tepe

Untitled

Jun 2nd, 2026
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6.  
  7. int main(int argc, char * argv[]) {
  8.     if(argc < 3) {
  9.         printf("Nema dovolno argumenti\n");
  10.         return 0;
  11.     }    
  12.  
  13.     FILE * in = fopen(argv[1], "r");
  14.     FILE * out = fopen(argv[2], "w");
  15.  
  16.     if(in == NULL || out == NULL) {
  17.         printf("Ne postojat datotekite\n");
  18.         return 0;
  19.     }
  20.     int a, b;
  21.     fscanf(in, "%d%d", &a, &b);
  22.  
  23.     fprintf(out, "%d\n", a + b);
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment