Advertisement
Josif_tepe

Untitled

Feb 13th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #define MAX 505
  5.  
  6. int main(int argc, char* argv[])
  7. {
  8.     FILE *input = fopen(argv[1], "r");
  9.     FILE *output = fopen(argv[2], "w");
  10.     char niza[MAX];
  11.     int brojac = 0;
  12.     while(brojac < 3) {
  13.         fscanf(input, "%s", niza);
  14.         int a, b, c;
  15.         fscanf(input, "%d%d%d", &a, &b, &c);
  16.         if(((a + b + c) / 3) < 10) {
  17.             fprintf(output, "%s %d\n", niza, (a + b + c) / 3);
  18.         }
  19. //        fprintf(output, "%s", niza);
  20.         brojac++;
  21.     }
  22.    
  23.  
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement