FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 96   



Following program shows you how to print average of given 3 numbers.
In this program we get inputs from user and calculate average of given 3 numbers using following formula
Average of given 3 numbers = (input1 + input2 + input3) / 3

var input1 = parseInt(prompt("Enter first number:"));
var input2 = parseInt(prompt("Enter second number:"));
var input3 = parseInt(prompt("Enter third number:"));
var result = (input1 + input2 + input3) / 3;
console.log("The average of three numbers: " + result);

Output:

Enter first number:
20
Enter second number:
10
Enter third number:
30
The average of three numbers: 20



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News