Javascript

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

JAVASCRIPT PART 1

1. // the hello world program


console.log('Hello');
console.log('Alexandra Abramov')

2.const num1 = 74;


const num2 = 36;

// add two numbers


const sum = num1 + num2;

console.log (sum)

3.const num1 = 50;


const num2 = 3;

// add two numbers


const ans = num1 / num2;

console.log (ans)

5.// store input numbers


const num1 = parseInt(prompt('Enter the first number '));
const num2 = parseInt(prompt('Enter the second number '));

//add two numbers


const sum = num1 * num2;

// display the sum


console.log('The sum of ' + num1 + ' and ' + num2 + ' is: ' + sum);

7./ Javascript program to print


// table of a number

let n = 8;
for (let i = 1; i <= 10; ++i)
console.log(n + " * " + i + " = " + n * i);

JAVASCRIPT EXERCISES PART 2


166.let a = prompt('Input an Integer: ');
console.log(`String format of the said integer: ${a}`);

168.const a = parseInt(prompt('Enter the first number '));


const b = parseInt(prompt('Enter the second number '));

const product = (a, b) => {


const logProduct = Math.log(a) + Math.log(b);
return Math.round(Math.exp(logProduct));
};
console.log(product(a,b));

You might also like