Write a program that takes as command-line arguments an integer N and a double value p (between 0 and 1), plots N equally spaced dots of size .05 on the circumference of a circle, and then, with probability p for each pair of points, draws a gray line connecting them.

Respuesta :

Answer:

Please see below

Explanation:

Suppose N = 10. And you have these dots equidistant from each other, and probability = 0.3. According to the data provided in the question statement, we will then have forty-five pairs of points. The task is to draw lines amongst these pairs, all 45 of them, with a 30% probability. Keep in mind that every one of the 45 lines are independent.

A few lines of simple code (just some for loops) needed to run this is attached in the image herewith, .

 

Ver imagen hihirasohail