title: lisp program to calculate the sum of n numbers
body: <pre><code>(defun sum-n-numbers(n)(if(=n 1)
  1
  (+N(sum-n-numbers(-n 1))))) 
  </code></pre>
  
  <p>Edit 2:<code>(defun sum-n-numbers(n)
          (if(=n 1)
          1
          (+N(sum-n-numbers(-n 1))
          )<br>
          )<br>
          )</code> 
  The above code runs but when I type (SUM-N-NUMBERS 1 3 2) for the output,it does not work and I get errors.<br>
  I know this simple code can also be executed by the inbuild lisp function (+ 1 3 2) that automatically calculates the sum of the numbers,but I have an exam question where it is asked to calculate the sum of n numbers using the defun function.</p>
  
  <p>Edit 1: This is the error that I am getting:  </p>
  
  <pre><code>Error: Call ((LAMBDA (#:N) (DECLARE (SPECIAL:SOURCE #) (LAMBDA-NAME SUM-N-NUMBERS))                  (BLOCK #:SUM-N-NUMBERS (IF # 1 #))) 1 3 2) has the wrong number of arguments.
  1 (abort) Return to level 1.
  2 Return to debug level 1.
  3 Return to level 0.
  4 Return to top loop level 0.
  </code></pre>