#include main() { int num; int square; FILE * input; FILE * output; input = fopen("day1a.dat", "r"); /* Open the data file for reading */ fscanf(input, "%d", &num); /* Read the number */ square = num * num; output = fopen("day1a.sol", "w"); /* Open the solution file */ fprintf(output, "%d", square); /* Write out the square value */ /* And now close the files */ fclose(input); fclose(output); }