Advertisement
palmerstone

Numbers

Oct 30th, 2011
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6. #include <time.h>
  7.  
  8. int main()
  9. {
  10. int t, i, j, k, l, a, b, c, d, x, y, z, n, flag = 0, ar[300];
  11. char str[1000], str2[1000];
  12.  
  13. freopen("numbers.txt", "w", stdout);
  14. srand(time(0));
  15. for (i = 0; i < 100;)
  16. {
  17. y = 0, x = (rand() % 200) + 1;
  18. for (l = 0; l < i; l++)
  19. {
  20. if (ar[l] == x)
  21. {
  22. y = 1;
  23. break;
  24. }
  25. }
  26. if (y == 0) ar[i++] = x;
  27. }
  28.  
  29. for (l = 0; l < i; l++) printf("%d\n", ar[l]);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement