Prateek Agarwal wrote: > I had to make a program to estimate the value of pi using Ramanujan's > method. > > I have made the program but it is giving the following error > > Question1.rb:8:in 'factorial':Interrupt You pressed ctrl-C? I'm surprised it even ran at all: def factorial(x) if (x==0) then return (1) end else ... something else This doesn't make sense syntactically - an 'else' without an 'if'. You need: if x == 0 return 1 else ... something else end -- Posted via http://www.ruby-forum.com/.