0% found this document useful (0 votes)
3 views3 pages

Jssop 2

The document contains three JavaScript code snippets that perform different tasks. The first snippet checks if two user-input numbers are equal, the second calculates the square of a user-input number, and the third checks if a user-input integer is a multiple of 3 or 7. Each code snippet includes HTML structure and prompts for user input.

Uploaded by

palatharv50
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Jssop 2

The document contains three JavaScript code snippets that perform different tasks. The first snippet checks if two user-input numbers are equal, the second calculates the square of a user-input number, and the third checks if a user-input integer is a multiple of 3 or 7. Each code snippet includes HTML structure and prompts for user input.

Uploaded by

palatharv50
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SKILL SET 3 || JAVASCRIPT || SOP 2

Code:-

<html>
<head>
<title>sop2</title>
</head>
<body>
<h1> To accept two positive or negative numbers and check whether they are
equal or not </h1>
<script language=javascript>
var n1,n2
n1=prompt("Enter first number positive or negative","type here")
n2=prompt("Enter second number positive or negative ","type here")
if(n1==n2)
document.write(n1+ " and " + n2+" are equal")
else
document.write(n1+ " and " + n2+" are not equal")
</script>
</body>
</html>
Code:-

<html>
<head>
<title>sop2</title>
</head>
<body>
<h1> To accept a number and display square of it </h1>
<script language=javascript>
var n,sq
n=prompt("Enter any number","type here")
sq=n*n
document.write("Square = " +sq)
</script>
</body>
</html>
Code:-

<html>
<head>
<title>sop2</title>
</head>
<body>
<h1> To check whether the accepted integer is multiple of 3 or multiple
of 7 </h1>
<script language=javascript>
var n
n=prompt("Enter a number")
if((n%3==0)||(n%7==0))
document.write(n + " is multiple of 3 or 7 ")
else
document.write(n + " is not multiple of 3 or 7 ")
</script>
</body>
</html>

You might also like