Page 138 - Computer Software Application TP - Volume 1
P. 138
COMPUTER SOFTWARE APPLICATION - CITS
let b = 5;
// Addition
let sum = a + b;
console.log(“Sum:”, sum); // Output: 15
// Subtraction
let difference = a - b;
console.log(“Difference:”, difference); // Output: 5
// Multiplication
let product = a * b;
console.log(“Product:”, product); // Output: 50
// Division
let quotient = a / b;
console.log(“Quotient:”, quotient); // Output: 2
// Modulus
let remainder = a % b;
console.log(“Remainder:”, remainder);
// Output: 0 (10 divided by 5 leaves no remainder)
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Go to the browsers console tab and verify the output.
II Comparison operators
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> Comparison operators </title>
123
CITS : IT & ITES - Computer Software Application - Exercise 38 CITS : IT & ITES - Computer Software Application - Exercise 38