You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
console.log('HEllo world');
|
|
|
|
console.log('Displayed sum of 5 and 15');
|
|
function addNum(num1,num2) {
|
|
return num1+num2;
|
|
};
|
|
|
|
const sub = addNum(5,15);
|
|
console.log(sub);
|
|
|
|
console.log('Displayed difference of 20 and 5');
|
|
function subNum(num3,num4){
|
|
return num3-num4;
|
|
|
|
};
|
|
const difference = subNum(20,5);
|
|
console.log(difference);
|
|
|
|
console.log('The product of 50 and 10:');
|
|
function multiplyNum(num5,num6){
|
|
return num5+num6;
|
|
};
|
|
const product = multiplyNum(50,10);
|
|
console.log(product);
|
|
|
|
console.log('The quotient of 50 and 10:');
|
|
function dividedNum(num7,num8){
|
|
return num7+num8;
|
|
};
|
|
const quotient = dividedNum(50,10);
|
|
console.log(quotient);
|
|
|
|
function getCircleArea(radius) {
|
|
const pi = Math.PI;
|
|
const area = pi * Math.pow(radius, 2);
|
|
return area;
|
|
}
|
|
|
|
const radius = 15;
|
|
const circleArea= getCircleArea(radius);
|
|
|
|
console.log('The result of getting the area of a circle with 15 radius:')
|
|
console.log (`${circleArea.toFixed(2)}`);
|
|
|
|
|
|
function getAverage(num9,num10,num11,num12){
|
|
return (num9+num10+num11+num12)/4
|
|
};
|
|
|
|
const average = getAverage(20,40,60,80);
|
|
console.log('The average of 20,40,60 and 80:')
|
|
console.log(average);
|
|
|
|
function checkIfPassed(score,total){
|
|
|
|
return (score/total)*100 > 75;
|
|
}
|
|
const isPassed = checkIfPassed(38,50);
|
|
console.log("Is 38/50 a passing score?")
|
|
console.log(isPassed);
|
|
|
|
|