Problem 1: Write a C program that generates complex random numbers in [-1,1] (fo
ID: 3674754 • Letter: P
Question
Problem 1: Write a C program that generates complex random numbers in [-1,1] (for both the real and imaginary components) using the rand() function and RAND_MAX definition that are in the math.h library. Prompt the user to enter a number of random complex numbers that your program will generate. For each complex that you generate calculate the magnitude. Count the complex numbers that have a magnitude less than 1. Print out the fraction of number numbers generated that magnitude less than 1. Your program should have the following prototypes: #include #include #include void new_complex(float *real, float *imag); void mag(float *hyp, float *real, float *imag); Sample Output: Enter the number of simulations: 10 The Ratio is 0.700000 Do you want to continue? (enter y/n) y
Explanation / Answer
------------------------------------------------------------------------------------------------------------------------