double a1 = 0 ,b2 = 1; int n = 1; while( n <= 20 ) { b2 = b2 * n++; a1 = a1 + 1 / b2; } System.out.println(a1);