0% found this document useful (0 votes)
0 views9 pages

LabMan WebAppXII

Uploaded by

Mohd Shayaan
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)
0 views9 pages

LabMan WebAppXII

Uploaded by

Mohd Shayaan
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/ 9

Prg1: WRITE A FUNCTION TO CALCULATE THE SIMPLE INTEREST BY TAKING INPUT.

<html><body>

<p> Function With arguments that returns the Simple Interest </p>

<p id="demo"></p>

<script>

function mysimple(p,r,t)

s=(p*r*t)/100;

return(s);

var p=parseFloat(prompt("Enter the value of Principal Amount"))

var r=parseFloat(prompt("Enter the value of Rate of Interest"))

var t=parseFloat(prompt("Enter the value of Time"))

document.getElementById("demo").innerHTML=mysimple(p,r,t);

</script>

</body>

</html>

Prg2: WRITE A PROGRAMME TO FIND THE LARGEST NUMBER AMONG THREE VARIABLES.

<html> <body> <script>

const num1 = parseFloat(prompt("Enter first number: "));

const num2 = parseFloat(prompt("Enter second number: "));

const num3 = parseFloat(prompt("Enter third number: "));

let largest;

// check the condition

if(num1 >= num2 && num1 >= num3)


{

largest = num1;

else if (num2 >= num1 && num2 >= num3)

largest = num2;

else

largest = num3;

document.write(largest);

</script>

</body>

</html>

Prg3: WRITE A PROGRAMME TO CHECK INPUT NUMBER IS EVEN / ODD

<html><body>

<p> To check input number is Even/ odd </p>

<p id="demo"></p>

<script>

var a=parseInt(prompt("Enter the value of a "))

if (a%2==0)

document.write("EVEN Number"+a);

}
else

document.write("ODD Number"+a);

</script></body></html>

Prg4: WRITE A PROGRAMME TO PRINT FOLLOWING SERIESE


“1,5,2,10,3,15,4,20,5,25,6,30,7,35,8,40,9,45,10,50”

Prg5: WRITE A PROGRAMME TO REMOVE THE LAST ELEMENT OF THE ARRAY USING POP()

<html>

<body>

<p id="demo">Click the button to remove the last array element.</p>

<button onclick="myFunction()">Click me</button>

<script>

var fruits=new Array();

fruits[0]="apple";

fruits[1]="mango";
fruits[2]="orange";

fruits[3]="banana";

function myFunction()

var x=document.getElementById("demo");

x.innerHTML=fruits;

fruits.pop();

</script>

</body>

</html

Prg6: WRITE A PROGRAMME TO FIND THE FACTORIAL OF ANY INPUT NUMBER (

[factorial of n (n!) = 1 * 2 * 3 * 4.....n]

<html> <body> <script>

// take input from the user

const number = parseInt(prompt('Enter a positive integer: '));

// checking if number is negative

if (number < 0) {

document.write('Error! Factorial for negative number does not exist.');

// if number is 0

else if (number === 0) {


document.write(`The factorial of ${number} is 1.`);

// if number is positive

else {

let fact = 1;

for (i = 1; i <= number; i++) {

fact *= i;

document.write(`The factorial of ${number} is ${fact}.`);

</script>

</body>

</html>

Prg7: WRITE A PROGRAMME TO FIND COMMISSION OF SALES MAN ON THE BASIS OF SALE.

SALE COMMISSION

0-10000 10%OF SALES

10001-20000 20%OF SALES

20001-30000 30%OF SALES

>=30001 40% OF SALES

<html><head> <title>COMMISSION</title>

</head><body>

<script type="text/javascript">

var s=parseInt(prompt("Enter your sale"));

if(s>=0 && s<=10000)


{

c=s*(10/100)

else if(s>=10001 && s<=20000)

c=s*(20/100)

else if (s>=20001 && s<=30000)

c=s*(30/100)

else

c=s*(40/100)

document.write(c)

</script></body></html>

Prg8: WRITE A PROGRAMME TO FIND NET SALARY OF AN EMPLOYEE .

BSAL DA HRA IT

0-10000 10%OF BSAL 1000 0

10001-20000 20%OF BSAL 2000 5%OF BSAL

20001-30000 30%OF BSAL 3000 10%OF BSAL

30001-40000 40%OF BSAL 4000 15%OF BSAL

>=40001 50%OF BSAL 5000 25%OF BSAL

NET SALARY= (BSAL+DA+HRA)-IT


<html><head><title>COMMISSION</title>

</head><body>

<script type="text/javascript">

var s=parseInt(prompt("Enter your Basic sale->"));

if(s>=0 && s<=10000)

da=s*(10/100)

hra=1000

it=0

else if(s>=10001 && s<=20000)

da=s*(20/100)

hra=2000

it=s*(5/100)

else if (s>=20001 && s<=30000)

da=s*(30/100)

hra=3000

it=s*(10/100)

else if(s>=30001 && s<=40000)

da=s*(40/100)
hra=4000

it=s*(15/100)

else

da=s*(50/100)

hra=5000

it=s*(25/100)

nsal=(s+da+hra)-it

document.write("Net Salary ->"+nsal);

</script></body></html>

Prg9: WRITE A PROGRAMME TO CHECK THE INPUT NUMBER IS PRIME NUMBER OR NOT.

<html> <body> <script>

var n=parseInt(prompt("Enter your Number you want to check->"));

let c=0;

for (i=1;i<=n; i++)

if (n%i==0)

c++;

if (c==2)

{
document.write("Prime Number");

else

document.write("Not a Prime Number");

</script> </body> </html

Prg10: WRITE A PROGRAMME TO PRINT THE FIBONACCI SERIESE : 0,1,1,2,3,5,8,13,21,34

<html><body><script>

var n=parseInt(prompt("Enter Number of Terms You want to display Fibonacci ->"));

let x=0,y=1;

document.write(x+","+y+",");

n=n-2;

while(n>0)

z=x+y;

document.write(z+",");

x=y;

y=z;

n=n-1;

</script> </body> </html>

You might also like