Advertisement
youuw

2.c

Nov 29th, 2021
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. /*
  2. Zadanie 2. Napisac program wypelniajacy tablice jednowymiarowa o rozmiarze n=50
  3. liczbami losowymi z przedzialu 0 - 1, a nastepnie wy±wietlic ja na ekranie monitorze.
  4.  
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>./2.
  9. #include <time.h>
  10.  
  11. int main(int argc, char **argv) {
  12.  
  13.     srand( time(NULL) );
  14. ;
  15.     int size = 50;
  16.     float tab[size];
  17.     for(int x = 0; x<size; x++)     {
  18.         tab[x] = (100+(rand()%899));
  19.         tab[x] /= 1000;
  20.     }
  21.     printf("wylosowane liczby to: \n");
  22.     for(int x = 0; x<size; x++) printf("%d. %.02f\n", x+1, tab[x]);
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement