Cod sursa(job #199495)
| Utilizator | Data | 18 iulie 2008 23:27:41 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv)
{
FILE *f, *g;
long a, b;
f = fopen("adunare.in", "r+b");
g = fopen("adunare.out", "w+b");
if (f == NULL)
{
printf("Nu pot deschide fisierul. \n");
return 0;
}
if (g == NULL)
{
printf("Nu pot deschide fisierul. \n");
return 0;
}
fseek(f, 0, SEEK_SET);
fscanf(f, "%ld", &a);
fscanf(f, "%ld", &b);
fprintf(g, "%ld", a+b);
fclose(f);
fclose(g);
return 0;
}