Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void) {
- int i,num = 500;
- double x[num];
- double y[num];
- srand(149);
- for (i = 0; i < num; i++) {
- x[i] = -5.0 + ((double) rand()) / RAND_MAX * 10.0;
- y[i] = -5.0 + ((double) rand()) / RAND_MAX * 10.0;
- if (x[i] * x[i] + y[i] * y[i] > 25.0) i--;
- }
- for (i = 0; i < num; i++)
- printf("% g % g % g\n", x[i], y[i], x[i] * x[i] + y[i] * y[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement