Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- int main(int argc, const char * argv[]) {
- FILE *in = fopen("input.txt", "r");
- FILE * out = fopen("output.txt", "w");
- if(in == NULL) {
- printf("Fajlot ne postoi\n");
- return 0;
- }
- if(out == NULL) {
- printf("Fajlot ne postoin\n");
- return 0;
- }
- char s[1000];
- int a, b, c;
- int brojac = 0;
- while(fscanf(in, "%s%d%d%d", s, &a, &b, &c) != EOF) {
- int prosek = (a + b + c) / 3;
- if(prosek < 10) {
- fprintf(out, "%s %d\n", s, prosek);
- brojac++;
- }
- }
- fprintf(out, "%d\n", brojac);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement