Computer Science Java Script/Coding Question!?

Computer Science Java Script/Coding Question!?




Hi, I'm in a computer science class and I have gotten really behind because of personal problems.



I have a project I need to do and I don't understand at all.



Here's the first problem that I need to do



Write a Javascript program that asks the user for a number

and then prints all the even numbers from 0 to that number

(inclusively).

Example:

input: 10

output 0 2 4 6 8 10

Example 2:

input: -1

output:

Example 3:

input: 5

output: 0 2 4



And here's the second problem

Write a JavaScript program to calculate addition,

subtraction, multiplication, and division of two numbers

(input from user).

<html>

<body>

<form name= " calc">

F i r s t Number : <input type= " text" name= "num1" >

Second Number : <input type= " text " name= "num2 " >

<input type= " button " value= " Addition "

onClick= ’ window . alert ( "Sum: " ’>

<input type= " button" value= " Subtraction"

onClick= ’ window . a l e r t ( " D iff e r e n c e : " ) ; ’ >

<inpu t type= " b utt o n " value= " M u l t i p l i c a t i o n "

onClick= ’ window . a l e r t ( " P roduct : " ) ; ’ >

<inpu t type= " b utt o n " value= " D i v i s i o n "

onClick= ’ window . a l e r t ( " D i v i s i o n : " ) ; ’ >

< /form>

< /body>

< /html>

Hint: Look at examples that utilize forms



Okay, there are some spacing problems in the second one I am too lazy to fix.

A little guidance would be nice! I'm not asking for anyone to do the problem for me - just help.





No Answers Posted Yet.