lisp do loop factorial code -


  (defun fact (n) (करू ((i 1 (+ 1 i)) (प्रॉड 1 (* I prod))) ((बराबर) प्रॉड)))  

मैंने ऊपर कोड किया है और जब मैं कोशिश करता हूँ, तथ्य (4) , इसे दे मुझे उत्तर 6 है । मुझे यकीन नहीं है कि क्या गलत हो रहा है क्या कोई मेरी मदद कर सकता है?

में बदलें

  (defun fact (n) (do ( (I 1 (+ 1 i)) (प्रोड 1 (* i प्रॉड))) ((बराबर i (+ n 1)) ठेका)))  

असल में, आप एक कर रहे थे आवश्यक से कम चलना।


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -