Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.30 KB | None | 0 0
  1.   public static void main(String[] args) {
  2.     int n = 1;
  3.     double sum = 0.0f;
  4.     System.out.println((double)9/10);
  5.     while (n < 10000) {
  6.       int p = ((n*n)+n)/2;
  7.       if (p%2 == 1) {
  8.         sum += 2*(double)1/(Math.pow(3, n));
  9.       }
  10.       n++;
  11.     }
  12.     System.out.println(sum);
  13.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement