hello everyone. So here is the story behind this program. I was in math class and I was using my calculator to see what I could divide 360 by to get pi (as close as I can get). But it was taking forever so I made a program that should do it for me but the while loop never stops. That is my problem so can you help.
Code:#include <stdio.h> main() { double getpi = 115; double findpi; double pi = 3.141592; printf("finding please wait..."); while (findpi != pi) { printf("\ngetpi = %f findpi = %f",getpi,findpi); getpi = getpi - .000001; findpi = 360/getpi; printf(" findpicheck %f",findpi); } printf("found your pie :D findpi = %f getpi = %f",findpi,getpi); getch(); }



LinkBack URL
About LinkBacks



