0
respuestas

Solucion reto seccion 3

Hola de nuevo! Dejo mi codigo para la actividad de la seccion # 3

// Challenge Section #3
// Activity #1
const calcIMC = function (height, weight) {
  return weight / (height * height);
};
console.log(calcIMC(1.47, 32));

// Activity #2
function calcFactorial(number) {
  for (let i = number - 1; i > 0; i--) {
    number *= i;
  }
  return number;
}
console.log(calcFactorial(5));

// Activity #3
const convertDollar = (dollar) => {
  return dollar * 4.8;
};
console.log(convertDollar(2));

// Activity #4
function calcRectangle(width, height) {
  console.log(`The rectangle's area is ${width * height}`);
  console.log(`The rectangle's perimeter is ${width * 2 + height * 2}`);
}
calcRectangle(5, 10);

// Activity #5
const calcCircle = function (radius) {
  console.log(`The circle's area is ${3.1416 * (radius * radius)}`);
};
calcCircle(10);

// Activity #6
const showMultiplyTable = (table) => {
  for (let i = 1; i <= table; i++) {
    console.log(`${table} x ${i} = ${table * i}`);
  }
};
showMultiplyTable(10);