Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a, b;
- FILE* input, *output;
- input = fopen("in.txt","r");
- output = fopen("out.txt","w");
- if(input == NULL || output == NULL) // Ellenőrizzük, hogy sikerült-e megnyitni a fájlt.
- {
- printf("Could not open one of the files!\n");
- return -1;
- }
- while(fscanf(input, "%d %d", &a, &b) != EOF)// End of file-ig olvasunk be.
- {
- int szorzo;
- scanf("%d", &szorzo);
- fprintf(output,"%d\n", (a+b) * szorzo);
- }
- fclose(input);
- fclose(output);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement