NEP CMA

PART -A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8

PART-B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

6.Create an interactive web page using HTML5 layout tags.

 
  
  
6.Write a JavaScript to design a simple calculator to perform the following operations: sum, product,
difference and quotient 

<!DOCTYPE html>
<html>
<head>
  <title>Program 6</title>
<style> 
*{
text-align:center;
}

</style>
  <script type="text/javascript">

// Function to add two numbers
function sum(num1, num2) {
  return num1 + num2;
}

// Function to multiply two numbers
function product(num1, num2) {
  return num1 * num2;
}

// Function to subtract two numbers
function difference(num1, num2) {
  return num1 - num2;
}

// Function to divide two numbers
function quotient(num1, num2) {
  if (num2 !== 0) {
    return num1 / num2;
  } else {
    return "Cannot divide by zero";
  }
}

// Example usage:
const number1 = prompt("Enter first value: ");
const number2 = prompt("Enter second value: ");

alert("RESULTS: n1=" +number1+ " n2=" +number2+ 
"\nSum: "+sum(number1, number2) +
"\nProduct: " + product(number1, number2)+
"\nDifference: "+ difference(number1, number2)+
"\nQuotient: "+ quotient(number1, number2));

 </script>
</head>
<body>
<h1>Program 6</h1>
</body>
</html>