Q:

Write a JavaScript program to add two digits of a given positive integer of length two

0

Write a JavaScript program to add two digits of a given positive integer of length two

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function add_two_digits(n)
   {
      return n % 10 + Math.floor(n / 10);
   }
console.log(add_two_digits(25))
console.log(add_two_digits(50))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now