Mai intai trebuie sa te autentifici.
Cod sursa(job #199490)
Utilizator | Data | 18 iulie 2008 23:14:31 | |
---|---|---|---|
Problema | A+B | Scor | 0 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <stdio.h>
#include <stdlib.h>
long int suma_numere(int a, int b)
{
long int suma;
suma = a+b;
return suma;
}
int main (int argc, char ** argv)
{
FILE *f, *g;
int 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, "%d", &a);
fscanf(f, "%d", &b);
fprintf(g, "%ld", suma_numere(a, b));
fclose(f);
fclose(g);
return 0;
}