I'm doing a program that aproximate PI and i'm trying to use long long, but it isn't working. Here is the code
#include<stdio.h>
#include<math.h>
typedef long long num;
main(){
num pi;
pi=0;
num e, n;
scanf("%d", &n);
for(e=0; 1;e++){
pi += ((pow((-1.0),e))/(2.0*e+1.0));
if(e%n==0)
printf("%15lld -> %1.16lld
",e, 4*pi);
//printf("%lld
",4*pi);
}
}
See Question&Answers more detail:os