function calculate_pi(a)

NumTerms = str2num(a);
pie = 0;
for i = 1:NumTerms
    pie = pie + (-1)^(i + 1) / (2 * i - 1);
end

disp(['Value of Pi after ',num2str(NumTerms),' terms of Gregory series is ',num2str(pie*4,16)])
