Question: HTML5 with Javascript Write a program that asks the user for meditation numbers. The user should be allowed to enter as many data set as

HTML5 with Javascript

Write a program that asks the user for meditation numbers.

The user should be allowed to enter as many data set as desired (or enter -999 to quit).

You must use do...while or while loop.

The output should look like the example output shown.

Indicate if an entered number is divisible by three or divisible by four.

The program should output the number of numbers divisible by three, their sum and average.

The program should output the number of numbers divisible by four, their sum and average

Here's my program so far

Richard's Kung Fu Panda Po Divisibility (3s and 4s) Log

var count3 = 0;//count numbers divisible by 3

var count4 = 0;//count numbers divisible by 4

var sum3 = 0;//sum numbers divisible by 3

var sum4 = 0;//sum numbers divisible by 4

var avg3;//avg divisible by 3

var avg4;//avg divisible by 4

function loopOne(){

num = Number( prompt("Enter an integer (or enter -999 to QUIT):"));

if(num == -999)

else{

if (num % 3 == 0){//logic for no divisible by 3

count3 = count3 + 1;

document.getElementById("c3").innerHTML= "You entered " + count3 + " numbers divisible by three.";

sum3 = sum3 + num;

document.getElementById("s3").innerHTML= "The sum of these numbers is " + sum3 + ".";

avg3 = sum3 / count3;

document.getElementById("a3").innerHTML ="The average of these numbers = " sum3 + " / " + count3 + " = " + avg3;}

if(num%4==0){//logic for no divisible by 4

count4 = count4 + 1;

document.getElementById("c4").innerHTML= "You entered " + count4 + " numbers divisible by four.";

sum4 = sum4 + num;

document.getElementById("s4").innerHTML= "The sum of these numbers is " + sum4 + ".";

avg4 = sum4 / count4 ;

document.getElementById("a4").innerHTML ="The average of these numbers = " sum4 + " / " + count4 + " = " + avg4;}}}

Richard's Kung Fu Panda Po Divisibility (3s and 4s) Log

Click on the button to enter Po's meditation numbers.

Richard will keep track of numbers divisible by three and four.

Po's Meditation Numbers:

needs to list the number and if it is divisble by 3 or 4 here

Expected Outcome

HTML5 with Javascript Write a program that asks the user for meditation

numbers. The user should be allowed to enter as many data set

Example Outputas desired (or enter -999 to quit). You must use do...while or

Richard Ricardo's Kung Fu Panda Po Divisibility (3s and 4s) Log Click on the button to enter Po's meditation numbers. Richard will keep track of numbers divisible by three and four. Richards Po mecitaon numbers Po's Meditation Numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!