reset password
Author Message
304374842
Posts: 56
Posted 20:43 Mar 31, 2016 |

Has anyone gotten the Lab 2 question.  I get a result but it isn't the right result.  I keep getting 4 instead of PI.  Anyone else  having this problem?

k1ngandy
Posts: 2
Posted 20:48 Mar 31, 2016 |

when dividing instead of putting 1/3, put 1.0 / 3.0

aalva190
Posts: 64
Posted 20:51 Mar 31, 2016 |

Yes. only division you must enter .0 infront of the interger. it has something to do with float which we learn later. But you should get an answer about 3.1 or so

304374842
Posts: 56
Posted 20:52 Mar 31, 2016 |

Thanks!

aalva190
Posts: 64
Posted 20:53 Mar 31, 2016 |

No Problem

kknaur
Posts: 540
Posted 21:01 Mar 31, 2016 |

Yes good work everyone.  We will go over why this happens next week.

64bitworldftw
Posts: 11
Posted 21:33 Mar 31, 2016 |

I got the output as 3.017071817071818 instead of pi or 3.14. Is this supposed to be the correct output or did I do  something wrong?

aalva190
Posts: 64
Posted 21:49 Mar 31, 2016 |

Well the answer is not supposed to be Pi exactly since u didnt enter the whole equation. The whole equation is the first equation he showed us and the equation he wants us to put is the second one, which is only part of the equation of the first one giving you an answer od 3.1 or so. So your good dont worry. If you find a way to enter the first equation(sequentials), maybe using loops. You should get Pi. 

 

kknaur
Posts: 540
Posted 06:52 Apr 01, 2016 |

As @Aalva190 said, the answer should be 3.01 something.  This is because we are using an infinite series to represent PI and we are not calculating with many terms of the series.  Later on after we talk about loops, you will do this problem again but with a lot more terms and you will see that the more terms you use, the closer you will get to the value of PI.