Write a script that reads in two integers and determines and outputs HTML text that displays whether the first is a multiple of the second. (Hint: Use the modulus operator.)

What will be an ideal response?


```
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3
4 <HEAD>
5 <TITLE>Solution: 13.28</TITLE>
6
7 <SCRIPT LANGUAGE = "JavaScript">
8 var number1, number2;
9
10 number1 = window.prompt( "Enter first integer: ", "0" );
11 number2 = window.prompt( "Enter second integer: ", "0" );
12
13 if ( ( number1 % number2 ) == 0 )
14 document.writeln( number1 + " is a multiple of " + number2 );
15
16 if ( ( number1 % number2 ) != 0 )
17 document.writeln( number1 + " is not a multiple of " + number2 );
18 </SCRIPT>
19 </HEAD>
20
21 <BODY>
22 <P>Click on Refresh (or Reload) to run script again
23 </BODY>
24 </HTML>
```

Computer Science & Information Technology

You might also like to view...

Using a(n) router instead of a hub can increase a network's performance and security.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Where does the Action Center display its alerts?

A) Notification area B) Start menu C) Taskbar D) Desktop

Computer Science & Information Technology

The question "Which pair of shoes would you like?", is an example of a binary question.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Optical drives are slower than hard drives

Indicate whether the statement is true or false

Computer Science & Information Technology