g = 9.8;
l = 1;
deltatime = 0.01;
periodvsamplitude = {{0, 0}};
For[j = 1, 
        j < 180, 
theta[1] = 
          j*Pi/180; 
omega[1] = 
          0; 
time[1] = 
          0; 
thetavstime = {{time[1], 
              theta[1]}}; 
omegavstime = {{time[1], 
              omega[1]}}; 
period = {0}; 

For[i = 1, 
          i < 1000, 
omega[i + 1] = 
            omega[i] - g/l*Sin[theta[i]]*deltatime; 
theta[
              i + 1] = 
            theta[i] + omega[i + 1]*deltatime; 
time[
              i + 1] = 
            time[i] + deltatime; 

If[
            Abs[(theta[i + 1] - theta[1])] < 
              10^(-3), 
period = 
                Append[period, 
                  time[i + 
                      1]];
]; 

thetavstime = 
            Append[thetavstime, {time[i + 1], 
                theta[i + 1]}]; 
omegavstime = 
            Append[omegavstime, {time[i + 1], 
                omega[i + 
                    1]}]; 
i++;
]; 


periodvsamplitude = 
          Append[periodvsamplitude, {theta[1], 
              2*period[
                  2]}]; 
j++;
];


ListPlot[
        periodvsamplitude];