Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h> // rand() ou random()
- #define n 100
- int main(void)
- {
- int i,a[n];
- double x[100];
- // gerando nova sequencia de numeros aleatórios:
- srand(218739);
- for (i=0;i<100;i++)
- {
- x[i]=(double) rand()/RAND_MAX;
- a[i]=rand()%n +1;
- a[i]=(double) rand()/RAND_MAX*n;
- printf("%lf\t %d \n",x[i],a[i]);
- }
- // RAND_MAX definido no <stdlib.h>
- // número aleatório entre 1 e RAND_MAX
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement