Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 337 Bytes

FIND_ERROR.md

File metadata and controls

13 lines (11 loc) · 337 Bytes

Find the Error / Improvement in the Following Code

Find the error(s) / improvement(s) in the following recursive method, and explain how to correct. This method should find the sum of the values from 0 to n

  public int sum( int n ) {
    if ( n == 0 )
       return 0;
    else
       return n + sum( n );
  }