Oct-10-2016, 11:09 PM
(Oct-10-2016, 10:47 PM)EwH006 Wrote: Anyway I'm looking to do the same thing with the code I gave but I need to use the following fractions, in which I don't know how apply to the syntax of while or for loops: 1/3 , 3/5, 5/7, 7/9, 9/11, 11/13, +..... all the way to 97/99 = 45.12445030305
It won't let me use floating point numbers in the for loop for sure.
You can use floating point numbers in a loop, but you can't use them in the range function. In this case you don't need to worry about that. Note that all those fractions are in the same format: n/(n + 2). So you need to loop over the n's (1 to 97, going up 2 each time), then add n/(n + 2) to your total each time through the loop.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures