Problem Statement
given two numbers, write a JavaScript program to find the average of these two numbers
Solution
to find the average of two numbers, find their sum using addition operator, and then divide the sum by 2 using division operator
(a + b) / 2
Program
given numbers are num1
and num2
. we find the average of num1
and num2
let num1 = 4;
let num2 = 8;
let sum = num1 + num2;
let average = sum / 2;
console.log(average);