Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. //Prototype
  6. float rando() ;
  7. void init(float tableau[]) ;
  8. void affiche(float tableau[]) ;
  9.  
  10. int main()
  11. {
  12.     float tab[15] ;
  13.     srand(time(NULL));
  14.  
  15.     init(tab) ;
  16.     affiche(tab) ;
  17.  
  18.     return 0;
  19.  
  20. }
  21.  
  22. float rando()
  23. {
  24.     float rd;
  25.     rd=rand()%(128+58)-57;
  26.     rd=rd/10;
  27.     return rd;
  28. }
  29.  
  30. void init(float tableau[])
  31. {
  32.     int i ;
  33.  
  34.     for (i=0 ; i < 15 ; i++)
  35.     {
  36.         tableau[i] = rando() ;
  37.     }
  38. }
  39.  
  40. void affiche(float tableau[])
  41. {
  42.     int i ;
  43.  
  44.     for (i=0 ; i < 15 ; i++)
  45.     {
  46.         printf("%f ", tableau[i]) ;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement