Created
November 30, 2011 10:37
-
-
Save vijaykiran/1408604 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn average-b | |
"Calculates average value of any numbers" | |
[] | |
(println "How many numbers ?") | |
(let [n (Integer/parseInt (read-line))] | |
(loop [m 1 sum 0] | |
(if (> m n) | |
(/ sum n) | |
(do | |
(println (str "Enter number " m ": ")) | |
(recur (inc m) (+ sum (Double/parseDouble (read-line))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment