Cod sursa(job #3230625)
| Utilizator | Data | 22 mai 2024 00:37:16 | |
|---|---|---|---|
| Problema | A+B | Scor | 100 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
// C program to implement
// the above approach
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Driver code
int main()
{
FILE* ptr1;
char str1[50], str2[50], result[50];
ptr1 = fopen("adunare.in", "a+");
fgets(str1, 50, ptr1);
int a = atoi(str1);
fgets(str2, 50, ptr1);
int b = atoi(str2);
FILE *ptr2;
ptr2 = fopen("adunare.out", "w");
int c = a + b;
sprintf(result, "%d\n", c);
fprintf(ptr2, result);
fclose(ptr1);
fclose(ptr2);
return 0;
}
