Skip to content

Instantly share code, notes, and snippets.

@manuj10
Last active December 18, 2015 00:59
Show Gist options
  • Save manuj10/5701051 to your computer and use it in GitHub Desktop.
Save manuj10/5701051 to your computer and use it in GitHub Desktop.
snippet for printing random numbers to a file
#include<stdio.h>
#include<stdlib.h>
int main()
{FILE * filepointer;
int v,i;
filepointer=fopen("input.txt","a+");
for (i=0;i<200;i++) /*getting numbers in range 0 to 50 randomly*/
{v=rand()%50;
fprintf(filepointer,"%d ",v);}
fclose(filepointer);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment