Jump to content

JavaScript prompts & other questions.


Recommended Posts

Part I

Create a JavaScript page that prompts the user to enter 5 numbers.

The numbers should be added together and then divide by 5 to get the average

You should use some type of loop for this, either a while or for loop.

Hint: when adding the numbers, each time you get a number, add it to a total variable

total=total+number;

Display to the document window "Your average is:" and the average.

Name the file grades.html

I dunno why, but I'm having more trouble with this than any of the other JavaScript assignments I've done so far.

My lack of coding done (and I'm sure I also left out some important stuff) is embarassing.

¬_¬

<HTML>

<HEAD>

<TITLE>Grades</TITLE>

<script LANGUAGE="JavaScript">

<!-- HIDE FROM INCOMPATIBLE BROWSERS

prompt("Please enter 5 numbers.");

Help? ¬_¬

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. To learn more, see our Privacy Policy