0% found this document useful (0 votes)
5 views7 pages

2nd Practical Css

This is Css practical

Uploaded by

mayur
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)
5 views7 pages

2nd Practical Css

This is Css practical

Uploaded by

mayur
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/ 7

Name :Mayur Sankpal Roll no:90

Practical 2nd of CSS

Condintional statement

1]If-else
<script>

var a=parseInt(prompt("enter the number that are check to even and odd"));

if(a%2==0)

document.write(a+" is even");

else

document.write(a+" is odd");

</script>

Output:

2]If-else Ladder
<script>

var a=parseInt(prompt("enter the First number :"));


var b=parseInt(prompt("enter the Second number :"));
var c=parseInt(prompt("enter the Third number :"));
if(a>b&&a>c)
document.write(a+" is largest");
else if(b>c)
document.write(b+" is largest");
else
document.write(c+" is largest");

</script>

Output :

3]Switch case
<script>

var day;
day=parseInt(prompt("enter the day between 1-7"));

switch(day){

case 1:
document.write("monday");
break;
case 2:
document.write("tuesday");
break;
case 3:
document.write("wednesday");
break;
case 4:
document.write("thursday");
break;
case 5:
document.write("friday");
break;

case 6:
document.write("saturday");
break;
case 7:
document.write("sunday");
break;
default:

document.write("enter the valid day");


}

</script>
Output:

Looping statements
1]for loop
<script>

for(var i=1;i<=10;i++){

document.write("<br>"+i);
}

</script>
Output:

2]While-loop
<script>
var a;
a=1;
document.write("using while loop");
while(a<=30){
document.write("<br>"+a);
a++;
};

</script>
Output:

3]Do-while
<script>
var a;
a=1;
document.write("using do while loop");
do{
document.write("<br>"+a);
a++;
}while(a<=20);

</script>
Output:

Extra programs
1]factorial
<script>
var num=parseInt(prompt("enter a number"));
var fact=1;
for(var i=1;i<=num;i++){
fact=fact*i;
}
document.write("factorial of given number is "+fact);

</script>
Output:
2]Fibonacci series
<script>
var num1=1,num2=2,num3;
var limit=parseInt(prompt("enter the limit"));
document.write("<br> fibonacci series:");
document.write("<br>"+num1+"<br>"+num2);
for(var i=1;i<limit;i++)
{num3=num1+num2;
document.write("<br>"+num3);
num1=num2;
num2=num3;
}
</script>
Output:

3]calculator
<script>
var a,b,c;
a=parseInt (prompt("enter the first number"));
b=parseInt (prompt("enter the second number"));
c=prompt("enter the operation do you perfom like +,-.*,/");
switch(c){
case "+":
document.write("addition is:"+(a+b));
break;
case "-":
document.write("Sub is:"+(a-b));
break;
case "*":
document.write("Mul is:"+(a*b));
break;
case "/":
document.write("Div is:"+(a/b));
break;

default:

document.write("enter the valid operation");


}

</script>
Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy