際際滷

際際滷Share a Scribd company logo
Developing skills in coding
javascript
*Copy the following codes into notepad and
replace any of the ^ symbols to make the
code work correctly.
1. To find the square root of a
number
<html>
<^>
<script type="text/javascript">
var numb= prompt("enter a number to find it's square root");
numb=parseInt(^);
var Result=numb^numb;
document.write("The square root is" Result");
</script>
</body>
<html>
2.Finding out if a triangle is a
right triangle
So in Maths, if a2 +
b2 = c2 then the
triangle is a right
triangle.
<html>
<body>
<script type="text/javascript">
var numb1=prompt("enter the adjacent of triangle?");
var numb^=prompt("enter the opposite of triangle?");
var numb3=prompt("enter the longest side/hypotenuse of
triangle?");
numb1=parseInt(numb^);
numb2=parseInt(numb2);
numb3=parseInt(numb^);
var Result=(numb1^numb1+numb2*numb2!=numb3);
^ (Result^=numb3)
{
document.write ("this is not right triangle");
}
else
{
document.write ("this is right triangle");
}
</script>
</body>
</html>
3.Getting the grades from a test
score
<html>
<body>
<script type="text/javascript">
var marks = prompt("enter the marks of test","");
marks=^(marks);
if(marks^=60)
{
document.write("grade is a");
}
else ^ (marks >=45)
{
document.write("grade is b");
}
else ^(marks >=30)
{
document.write("grade is c");
}
else
^
document.write("grade is f");
}
</script>
</body>
</html>
Writing javascript code
1.Create a program that when you enter a
number, it will be divided by 2.
* use the mathetical operator / to do this.
Writing javascript code
1.Create a program that when you enter a
number, it will be divided by 2.
* use the mathetical operator / to do this.

More Related Content

Code

  • 1. Developing skills in coding javascript *Copy the following codes into notepad and replace any of the ^ symbols to make the code work correctly.
  • 2. 1. To find the square root of a number <html> <^> <script type="text/javascript"> var numb= prompt("enter a number to find it's square root"); numb=parseInt(^); var Result=numb^numb; document.write("The square root is" Result"); </script> </body> <html>
  • 3. 2.Finding out if a triangle is a right triangle So in Maths, if a2 + b2 = c2 then the triangle is a right triangle.
  • 4. <html> <body> <script type="text/javascript"> var numb1=prompt("enter the adjacent of triangle?"); var numb^=prompt("enter the opposite of triangle?"); var numb3=prompt("enter the longest side/hypotenuse of triangle?"); numb1=parseInt(numb^); numb2=parseInt(numb2); numb3=parseInt(numb^); var Result=(numb1^numb1+numb2*numb2!=numb3); ^ (Result^=numb3) { document.write ("this is not right triangle"); } else { document.write ("this is right triangle"); } </script> </body> </html>
  • 5. 3.Getting the grades from a test score <html> <body> <script type="text/javascript"> var marks = prompt("enter the marks of test",""); marks=^(marks); if(marks^=60) { document.write("grade is a"); } else ^ (marks >=45) { document.write("grade is b"); } else ^(marks >=30) { document.write("grade is c"); } else ^ document.write("grade is f"); } </script> </body> </html>
  • 6. Writing javascript code 1.Create a program that when you enter a number, it will be divided by 2. * use the mathetical operator / to do this.
  • 7. Writing javascript code 1.Create a program that when you enter a number, it will be divided by 2. * use the mathetical operator / to do this.