Rekursif : Strange Result Calculating Series (Menghitung Hasil Deret Aneh)
Series is given as follows :
How to find value? We can make use of recursive programs. Now we see a plus sign (+) min (-) it. How do I tell? Absolutely, which is worth an odd marked plus (+) and a marked positive value min (-). From these observations we can use it as a key telling the program making.
Now we make a recursive program :
Proses_rekursif(int n){
if(n==0) return 0;
else if(n==1) return 1;
else if(n%2==0) return (-(1.0/n)+(proses2(n-1)));
else return ((1.0/n)+(proses2(n-1)));
}
You're curious about the full results? Definitely curious! Download HERE.
Jadilah yang pertama mengomentari
Post a Comment