Advertisement
nate23nate23

hw7 exercise 18.5 -late

Nov 19th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. /*
  2.  * Name:Nate Wheeler
  3.  * Date:november 18, 2016
  4.  * Course Number: csc220
  5.  * Course Name: data structures
  6.  * Problem Number: hw7
  7.  * Email: nate23nate23@gmail.com
  8.  * Short Description of the Problem:
  9.  * recursive summation series formula
  10.  */
  11.  
  12. package Assignments;
  13.  
  14. public class SumSeries {
  15.    
  16.     public static double sum(double x){
  17.          if (x ==0)
  18.                 return 0;
  19.             else
  20.                 return sum(x - 1.0) + x / (2.0 * x + 1.0);
  21.     }
  22.    
  23.     public static void main(String[] args) {
  24.         // TODO Auto-generated method stub
  25.         double anwser= sum(3);
  26.         System.out.println(anwser);
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement