0% found this document useful (0 votes)
1K views5 pages

Practical No: 1: 1) Write A Simple Javascript With HTML For Arithmetic Expression Evaluation

This document contains details of a student named Dixit Janhavi Rajesh enrolled as 21CO353 for their practical assignment no. 1. It includes code for a JavaScript program to perform arithmetic operations and print messages. The program defines variables for two numbers, performs addition, subtraction, multiplication, division, and modulus operations on them, and prints the results. It also uses document.write and alert to print a message.

Uploaded by

JANHAVI DIXIT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views5 pages

Practical No: 1: 1) Write A Simple Javascript With HTML For Arithmetic Expression Evaluation

This document contains details of a student named Dixit Janhavi Rajesh enrolled as 21CO353 for their practical assignment no. 1. It includes code for a JavaScript program to perform arithmetic operations and print messages. The program defines variables for two numbers, performs addition, subtraction, multiplication, division, and modulus operations on them, and prints the results. It also uses document.write and alert to print a message.

Uploaded by

JANHAVI DIXIT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Practical 1: Arithmetic Expression Evaluation: This practical exercise guides the user in writing a JavaScript code with HTML to perform arithmetic operations, including addition, subtraction, multiplication, division, and modulus.
  • Practical 2: Message Printing: This section covers the process of writing a simple JavaScript code within HTML to print a message using document.write and alert functions.

Name: Dixit Janhavi Rajesh

Enroll. No.: 1910510124


Roll. No.: 21CO353

Practical No : 1

1) Write a simple JavaScript with HTML for arithmetic


expression evaluation.
 Code :

<!DOCTYPE html>

<html>

<head>

<title>Javascript Arithmetic Operators</title>

</head>

<body>

<h1>Performing Arithmetic Operations </h1>

<script>

var m=28, n=7 ;

var addition, subtraction, multiplication, division, modulus;

addition = m + n;

subtraction = m - n;

multiplication = m * n;

division = m / n;
modulus =m % n;

[Link]("Addition of " + m +' and ' + n + " is = " + addition


+ "<br />");

[Link]("Subtraction of " + m +' and ' + n + " is = " +


subtraction + "<br />");

[Link]("Multiplication of " + m +' and ' + n + " is = " +


multiplication + "<br />");

[Link]("Division of " + m +' and ' + n + " is = " + division


+ "<br />");

[Link]("Modulus of " + m +' and ' + n + " is = " +


modulus + "<br />");

</script>

</body>

</html>
 Output :

2) Write a simple JavaScript with HTML for message


printing.
 Code :
<html>
<script language = "javascript" >
[Link]("Hello World...")
alert("Hello World!");
</script>
</html>
 Output :
**********

You might also like