//Writing to a file
#include <stdio.h>

void main()
{
int x,y;
FILE *fp;					 //declare file pointer

printf("Please enter a value for x: ");
scanf("%d",&x);
printf("\nYou entered %d ",x);

printf("\n\nPlease enter a value for y: ");
scanf("%d",&y);
printf("\nYou entered %d ",y);

fp=fopen("myfile.txt","w");   				//open file for writing
							//by default points to start of file
fprintf(fp,"%d ",x);					//write x to file
fprintf(fp,"%d",y);					//write y to file

fclose(fp);						//close file		



}