#include <stdio.h>
int main() {
FILE *fptr = fopen("greeting.txt", "w");
if (fptr == NULL) {
printf("Could not open the file.\n");
return 1;
}
// Send text into the file instead of the screen
fprintf(fptr, "Hello from C!\n");
fprintf(fptr, "Writing files is easy.\n");
fclose(fptr);
printf("Text saved to greeting.txt\n");
return 0;
}