Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum

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

Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum.

الأجوبة

function sumTriple (x, y) {
  if (x == y) {
    return 3 * (x + y);
    } 
   else
   {
    return (x + y);
   }
 }
console.log(sumTriple(10, 20));
console.log(sumTriple(10, 10));

 

هل كان المحتوى مفيد؟

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

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