Cod sursa(job #822958)
| Utilizator | Data | 24 noiembrie 2012 12:25:36 | |
|---|---|---|---|
| Problema | A+B | Scor | 100 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fp, *fr;
int a, b, result;
fp = fopen("adunare.in","r");
fr = fopen("adunare.out", "w");
if(fp == NULL || fr == NULL){
printf("could not open one of the files!");
exit(0);
}
fscanf(fp, "%d\n", &a);
fscanf(fp, "%d", &b);
result = a + b;
fprintf(fr, "%d", result);
fclose(fp);
fclose(fr);
return 0;
}