NumTerms = ToExpression[$CommandLine[[2]]];

Pie = 0;
Do [Pie+=(-1)^(i+1)/(2*i-1), {i,1,NumTerms}]

Print ["Value of Pi after " <> ToString[NumTerms] <> " terms of Gregory series is " <> ToString[N[Pie*4,16]]]
