Cod sursa(job #1865044)
| Utilizator | Data | 1 februarie 2017 11:26:14 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <stdio.h>
#include <stdlib.h>
void start()
{
FILE* fIn,*fOut;
int a,b,result;
fIn=fopen("adunare.in","r");
fOut=fopen("adunare.out","w");
if(fIn==NULL)
{
perror("Error at reading the input file.");
exit(1);
}
if(fOut==NULL)
{
perror("Error at creating the output file.");
exit(1);
}
while(!feof(fIn))
{
fscanf(fIn,"%d",&a);
fscanf(fIn,"%d",&b);
result=a+b;
fprintf(fOut,"%d",result);
}
fclose(fIn);
fclose(fOut);
}
int main(int argc,char*argv[])
{
start();
return 0;
}