Cod sursa(job #2246397)
| Utilizator | Data | 27 septembrie 2018 03:52:08 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <stdio.h>
void solve(const char* input_file_name, const char* output_file_name){
FILE* ifp;
ifp = fopen(input_file_name, "r");
int n, sum;
while(fscanf(ifp, "%d", &n) != EOF){
sum += n;
}
fclose(ifp);
FILE* ofp;
ofp = fopen(output_file_name, "w");
fprintf(ofp, "%d", sum);
fclose(ofp);
}
int main(){
solve("adunare.in", "adunare.out");
return 0;
}