Ask coding questions

← Back to all posts
I want to know all about how to write a program which will add two numbers.
henry92 (0)

Take through step-by-step on how to write a program that will add two numbers and provide the answer.

Comments
hotnewtop
RYANTADIPARTHI (6008)

Solution

try this code.

(let [num1 (do (println "What's first?") (Integer/parseInt (read-line)))
      num2 (do (println "What's sec?") (Integer/parseInt (read-line)))]
  (println (+ num1 num2)))

here's a link for more info.

https://stackoverflow.com/questions/58076459/addition-of-two-numbers-by-taking-user-input

That should work

SixBeeps (5061)

You want this in Clojure?