Question

Function P2<yourname>. When button problem 2 is clicked, a JavaScript function equivalent to the following flowchart should

How to find sum of the first and last 3 numbers? #Javascript

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE

============================================================================================

<!DOCTYPE html>
<html><head><title>welcome</title>
<script language="javascript">
i=1;
function myFunction() {
sum1=0;
sum2=0;
var num1 = parseFloat(prompt("Enter 1st number"));
var num2 = parseFloat(prompt("Enter 2nd number"));
var num3 = parseFloat(prompt("Enter 3rd number"));
var num4 = parseFloat(prompt("Enter 4th number"));
var num5 = parseFloat(prompt("Enter 5th number"));
var num6 = parseFloat(prompt("Enter 6th number"));

sum1=num1+num2+num3;
sum2=num4+num5+num6;

   if(sum1==sum2)
alert("yes");
   else
   alert("no");
}

</script>
</head>

<body>

<button onclick="myFunction()">Problem 2</button>
</body>

</html>

============================================================================================

Output

Add a comment
Know the answer?
Add Answer to:
How to find sum of the first and last 3 numbers? #Javascript Function P2<yourname>. When button...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and...

    in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...

  • i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

    i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

  • Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June...

    Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June 9th, 2018 @ 23:55 Percentage overall grade: 5% Penalties: No late assignments allowed Maximum Marks: 10 Pedagogical Goal: Refresher of Python and hands-on experience with algorithm coding, input validation, exceptions, file reading, Queues, and data structures with encapsulation. The card game War is a card game that is played with a deck of 52 cards. The goal is to be the first player to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT