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

  • برمجة جافاسكربت java script
  • برمجة

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

الأجوبة

function add_two_digits(n)
   {
      return n % 10 + Math.floor(n / 10);
   }
console.log(add_two_digits(25))
console.log(add_two_digits(50))
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...