Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main()
- {
- const double ANSWER = 3.14159;
- double response;
- printf("what is the value of pi?\n");
- scanf("%lf", &response);
- //printf("%lf",fabs(response-ANSWER));
- while (fabs(response-ANSWER)>0.0001)
- {
- //printf("%lf",fabs(response-ANSWER));
- printf("try again!\n");
- scanf("%lf", response);
- }
- printf("close enough!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement