fork(2) download
  1. #include <stdio.h>
  2. #include <time.h>
  3. int main()
  4. {
  5. int i=0,n,a[25]={0},b[25]={0},cntr=0;
  6. srand(time(NULL));
  7. while(cntr!=25)
  8. {
  9. n=rand()%26;
  10. if(n!=9)
  11. {
  12. if(a[n]!=1)
  13. {
  14. a[n]=1;
  15. printf("%d ",n);
  16. b[i]=n;
  17. printf("%d\n",b[i]);
  18. cntr++;
  19. i++;
  20. }
  21. }
  22. }
  23. printf("\n****************\n");
  24. for(i=0;i<25;i++)
  25. {
  26. printf("%d ",b[i]);
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
4  4
15  15
6  6
13  13
18  18
11  11
0  0
5  5
17  17
24  24
1  1
23  23
20  20
16  16
3  3
25  25
10  10
19  19
12  12
14  14
21  21
22  22
7  7
8  8
2  2

****************
1  15  6  13  18  11  0  5  17  24  1  23  20  16  3  25  10  19  12  14  21  22  7  8  2