Code:
#include <stdio.h>
#include <math.h>
#include "drand.h"
#define PI (4*atan(1))
int main(void)
{  
   double A, t, T, p, n, w, y, a, b, c;      
 
   A=drand()+1;
   T=((drand()+1)*10);
   w=(2*PI/T);
   p=drand()*2*(4*atan(1)); 
    
   for(t=0; t<=50; t++)
  {  n=(drand()*.6-.3)*A;      
     y=A*sin( w*t + p) + n;
    printf("%f %f \n\n", t, y);
 
  }
    return 0;
}
Now modify the program so that while generating the data it uses some method, of your choice, to produce a good estimate of the period from the data. The estimate must be based only on the y values, and could for example use a sliding window.
Then, at the end, generate separate sine data using your sine function with w based on the estimated period, the original values of A and p, and no noise, to plot over the same range of t with points and lines.

It orginally plots just points, now i need to plot a line in addition (along the points as much as possible).Thanks in advance and please keep it real simple if possible.