Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define TACNOST 0.001
- int main(int argc, char** argv) {
- double pi=0;
- int n=1;
- int jedan=1;
- while (1) {
- pi += jedan*(double)1/n;
- if ((double)1/n < TACNOST) break;
- n+=2;
- jedan = -jedan;
- }
- printf("pi = %.33lf", pi*4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement