SKILL SET 3 JavaScript All Code and Output PDF
SKILL SET 3 JavaScript All Code and Output PDF
• To accept two positive or negative numbers and check whether they are
equal or not.
• To accept a number and display the square of it.
• To check whether the accepted integer is multiple of 3 or multiple of 7.
Answer:
To accept two positive or negative numbers and check whether they are equal or
not.
<!DOCTYPE html>
<head> <title>program3</title> </head>
<body>
<script language=”javascript”> var no1,no2;
no1=prompt(‘Enter first number’);
no2=prompt(‘Enter Second number’);
if(no1==no2)
document.write(“Both are equal”);
else
document.write(“Given numbers are not equal”);
</script>
</body> </html>
To accept number and display square of it.
<!DOCTYPE html>
<head>
<title>To accept number and display square of it</title>
</head>
<body>
<script language-’j avascript”>
var no,sqr;
no=prompt(‘Enter Any number’);
sqr=no*no;
document, write (“The Square is=”+sqr);
</script>
</body>
</html>
• To check whether the accepted integer is multiple of 3 or multiple of 7.
<!DOCTYPE html>
<html> <head>
<title>To check whether the accepted integer is multiple of 3 or multiple of 7.
</title> </head>
<body>
<script language=JavaScript>
var a;
a=prompt(“Enter your first interger / number”);
if(a%3==0 | | a%7==0)
alert(“multiple of 3 or 7”);
else
alert(“not a multiple of 3 or 7”);
</script>
</body>
</html>
SOP 3: Create a JavaScript program for the following using appropriate variables,
JavaScript inbuilt string functions, and control structures.
• To accept numbers and validate if the given value is a number or not by clicking
on the button.
•
To calculate the addition and division of two numbers.