Skip to main content

Java cript :

 Document1



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body onload="fun()">
    <button onclick="fun()">JSR</button>
    <button onclick="run()">RANCHI</button>
    <button onclick="bun()">BOKARO</button>
    <div id="op"></div>
    <script>
        function fun()
        {
            document.getElementById("op").innerHTML="<b>Jamshedpur</b> is a large city set between the Subarnarekha and Kharkai rivers in the east Indian state of Jharkhand. It’s known for huge, tree-lined Jubilee Park, where the Tata Steel Zoological Park has resident species including tigers and leopards. To the east, the hilltop Bhuvaneshwari Temple has an elaborate 5-story entrance tower. North of the city, elephants roam through the forests at Dalma Wildlife Sanctuary.";
        }
        function run()
        {
            document.getElementById("op").innerHTML="<b>Ranchi</b> is the capital of the Indian state of Jharkhand. Ranchi was the centre of the Jharkhand movement, which called for a separate state for the tribal regions of South Bihar, northern Odisha, western West Bengal and the eastern area of what is present-day Chhattisgarh. ";

        }
        function bun()
        {
            document.getElementById("op").innerHTML="<b>Bokaro</b>, officially known as Bokaro Steel City, is a large and planned city in Jharkhand, India. It is the fourth most populous city in the state and one of the first planned cities of India. Bokaro is the administrative headquarters of Bokaro district.";
        }
    </script>
</body>
</html>

Using of Airthmetic operator: + , - , * , / , % , **.

To find Sum of two numbers.


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   
    <script>
        var a, b, sum;
        a=10;
        b=20;
        sum=a+b;
       //alert(sum);
       alert("Result= "+ sum);
    </script>
</body>
</html>

To find Area of a circle with alternate calling method.


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var r, result;
        r=10;
        result= 3.14*r*r;
        alert("Result= " + result);
    </script>
</body>
</html>

Using of Assignment Operator. = , += ,-= ,*= , /=


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        a=10;
        a+=5;
        alert(a);
    </script>
</body>
</html>

Using of Comparision operator: == , === , <= , >= , != (not equal to).

Eligible for vote / Not Eligible for vote

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       let age;
       age=30;
       if(age>=18)
       {
        alert("Eligible for vote");
       }
       else{
        alert("Not Eligible for vote");
       }
    </script>
</body>
</html>

Even No./Not Even No.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       var n;
       n=44;
       if(n % 2 == 0)
       {
        alert("Even No.");
       }
       else{
        alert("Not Even No.");
       }
    </script>
</body>
</html>

Positive no. /Negative no./ zero

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       var n;
       n=44;
       if(n > 0)
       {
        alert("Positive No.");
       }
       else if(n < 0)
       {
        alert("Negative No.");
       }
       else{
        alert("Value is Zero")
       }
    </script>
</body>
</html>

Comments

Popular posts from this blog

Memory Unit Computer Architecture

  Memory Hierarchy A memory unit is an essential component in any digital computer since it is needed for storing programs and data. Typically, a memory unit can be classified into two categories: The memory unit that establishes direct communication with the CPU is called  Main Memory . The main memory is often referred to as RAM (Random Access Memory). The memory units that provide backup storage are called  Auxiliary Memory . For instance, magnetic disks and magnetic tapes are the most commonly used auxiliary memories. Apart from the basic classifications of a memory unit, the memory hierarchy consists all of the storage devices available in a computer system ranging from the slow but high-capacity auxiliary memory to relatively faster main memory. The following image illustrates the components in a typical memory hierarchy. Auxiliary Memory Auxiliary memory is known as the lowest-cost, highest-capacity and slowest-access storage in a computer system. Auxiliary memory ...