Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int n;
- int ranges;
- int perc;
- int rans;
- inline int myrand()
- {
- return (rand()*rand())+rand();
- }
- main()
- {
- srand(time(NULL));
- freopen("1.in","w",stdout);
- n=10;
- ranges=10;
- perc=5;
- printf("%d\n",n);
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- rans=rand()%10000;
- if(rans<=perc){printf("0");}
- else{printf("%d",myrand()%ranges);}
- if(j!=n){printf(" ");}
- }
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment