Write A program to print Assignment Operator using Javascript (using variable).
Code : assignment-operator.html
<!-- write a java script program using assignment operator -->
<html>
<head>
<style type="text/css">
.body
{
font-size:30;
color:green;
}
</style>
</heaD>
<body class="body">
<p align="center">Assignment Operator </p>
<script type="text/javascript">
var x=15;
var y=10;
document.write("<br> x= 15 <br> y=10 ");
document.write("<br> (x+=y) : ");
document.write(x+=y); //now x=25
document.write("<br> (x-=y) : ");
document.write(x-=y); // now x=15
document.write("<br> (x*=y) : ");
document.write(x*=y); // now x=150
document.write("<br> (x/=y) : ");
document.write(x/=y); // now x=15
document.write("<br> (x%=y) : ");
document.write(x%=y); //now x=5
</script>
</body>
</html>
No comments:
Post a Comment