IT Pracs

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

SOP 1

<!DOCTYPE html>

<html>

<head><title>Maximum of Two</title></head>

<body bgcolor=black text=green>

<script language=”javascript”>

var a,b;

a = parseInt(prompt(“Enter 1st number”));

b = parseInt(prompt(“Enter 2nd number”));

//input is converted to number data type

If(a>b)

alert(a + “is greater than ” + b );

else

alert(a + “is greater than ” + a );

</script>

</body></html>
Multiple of 3

<!DOCTYPE html>

<html>

<head><title>multiplication</title> </head>

<body>

<script language="javascript">

var n1,output;

n1=parseInt(prompt("Enter any number: "));

output=n1*3;

document.write("<br>Three times the numbers is : "+ output);

</script></body></html>
Positive Negitive

<!DOCTYPE html>

<html>

<head><title>PositiveNegative</title></head>

<body bgcolor=black text= green>

<script language="javascript">

var a;

a=parseInt(prompt("Enter your value:-"));

// input is converted into number data type

if(a>0)

alert("Number is positive");

if(a==0)

alert("Number is zero");

if(a<0)

alert("Number is negative");

</script>

</body></html>
SOP 2

Divisible
<!DOCTYPE html>

<html>

<head><title>Divisible</title></head>

<body bgcolor=black text= green>

<script language="javascript">

var a;

a=parseInt(prompt("Enter your value:-"));

// input is converted into number data type

if(a%3==0)

alert("Number is a multiple of 3");

document.write(a+ " is a multiple of three");

if(a%7==0)

alert("Number is a multiple of 7");

document.write(a+ " is a multiple of 7");

if(a%3!=0 && a%7!=0)

document.write(a+ " is neither a multiple of 7 nor a multiple of 3");

</script>

</body></html>
Equal or Not

<!DOCTYPE html>

<html>

<head><title>EqualOrNot</title></head>

<body bgcolor=black text= green>

<script language="javascript">

var a,b;

a=parseInt(prompt("Enter an integer"));

b=parseInt(prompt("Enter an integer"));

// input is converted into number data type

if(a==b)

alert("Numbers are equal");

else

alert("Numbers are not equal");

</script>

</body></html>
<!DOCTYPE html>

<html>

<head><title>SquareOfANumber</title></head>

<body>

<script language="javascript">

var a,b;

a=parseInt(prompt("Enter an integer"));

b=a*a;

document.write("Square of the number is " + b);

</script>

</body></html>
SOP 3

<html>

<body>

<title>GreaterThan4</title>

<script type="text/javascript">

var s1,len;

s1=prompt("Enter the word ");

len=s1.length;

if(len>4)

document.write("String greater than 4");

else

document.write("String is not greater than 4");

</script>

</body>

</html>
String Length

<html>

<body>

<title>StringLength</title>

<script type="text/javascript">

var s1,len;

s1=prompt("Enter the word ");

len=s1.length;

document.write("Length of string " +len);

</script>

</body>

</html>
Upper Case Lower Case

<html>

<body>

<title>UpperCaseAndLowerCase</title>

<script type="text/javascript">

var s1,uppercase,lowercase;

s1=prompt("Enter the word ");

uppercase=s1.toUpperCase();

lowercase=s1.toLowerCase();

document.write("uppercase: " + uppercase);

document.write("<br>lowercase: " + lowercase);

</script>

</body>

</html>
SOP 4: Area of Rectangle

<!DOCTYPE html>

<html>

<head><title>Area of recctangle</title>

</head>

<body bgcolor=#09061B text = #00FDB1>

<h1> Program to calculate area of circle </h1>

<script language="javascript">

var length,breadth,area;

length=prompt("Enter the length of rectangle");

breadth=prompt("Enter the breadth of rectangle");

area=length * breadth;

document.write("<h1>Area of rectangle is :</h1>" +area);

</script>

</body></html>
SOP 5: Even Odd

<!DOCTYPE html>

<html>

<head><title>Even Odd</title></head>

<body bgcolor=black text= green>

<script language="javascript">

var a;

a=parseInt(prompt("Enter your value:-"));

// input is converted into number data type

if(a%2==0)

alert("Number is even");

document.write(a+ "<h1> is even</h1>");

else

alert("Number is odd");

document.write(a+ "<h1> is odd</h1>");

</script>

</body></html>
SOP 6 : Maximum of two

<!DOCTYPE html>

<html>

<head><title>Maximum of Two</title></head>

<body >

<script language="javascript">

var a,b;

a=parseInt(prompt("Enter 1st number"));

b=parseInt(prompt("Enter 2nd number"));

// input is converted into number data type

if(a>b)

alert(a + " is greater than "+ b);

else

alert(b + " is greater than "+ a);

</script>

</body></html>
SOP 7: multiplication

<!DOCTYPE html>

<html>

<head><title>multiplication</title> </head>

<body bgcolor="black" text=#39FF14>

<h1> Program to calculate multiplication of two numbers </h1>

<script language="javascript">

var n1,b2,sum;

n1=parseInt(prompt("Enter any number 1: "));

n2=parseInt(prompt("Enter any number 2: "));

sum=n1+n2;

document.write("<br><h1>multiplication of two numbers : "+sum+"</h1>");

</script>

</body></html>
SOP 8 : Area of the Circle

<!DOCTYPE html>

<html>

<head><title>Area of circle</title>

</head>

<body>

<h1> Program to calculate area of circle </h1>

<script language="javascript">

var r,area;

r=prompt("Enter the radius of circle");

area=3.14*r*r;

document.write("<h1>you entered radius value:</h1>" +r);

document.write("<h1>Area of circle is :</h1>" +area);

</script>

</body></html>
SOP 9 : Simple Interest

<!DOCTYPE html>

<html>

<head><title>Simple interest</title>

</head>

<body>

<h5> Program to calculate area of circle </h5>

<script language="javascript">

var principal,rate,term, interest, amount;

principal=parseInt(prompt("Enter the principal amount"));

rate=parseInt(prompt("Enter the rate of interest"));

term=parseInt(prompt("enter the amount of time"));

interest=(principal*rate*term)/100;

amount = parseInt(principal + interest);

document.write("<h1>Amount of interest recieved</h1>" +interest);

document.write("<h1>amount recieved after the term</h1>" +amount);

</script>

</body></html>

You might also like