Skip to content

Instantly share code, notes, and snippets.

@julianchams
Created October 2, 2014 20:43
Show Gist options
  • Save julianchams/0337f1dc65e7670af847 to your computer and use it in GitHub Desktop.
Save julianchams/0337f1dc65e7670af847 to your computer and use it in GitHub Desktop.
Homework #3
function squareNumber(num) {
var squaredNum = num*num;
console.log('The result of squaring the number ' + num + ' is ' + squaredNum);
return squaredNum;
}
function halfNumber(num) {
var halfNum = num/2;
console.log('Half of ' + num + ' is ' + halfNum);
return halfNum;
}
function percentOf(num1,num2) {
var percentageNum = num1*100/num2;
console.log(num1 + ' is ' + percentageNum + '% of ' + num2);
return percentageNum;
}
function areaOfCircle(radius) {
var area = radius*radius*3.14;
console.log('The area for a circle with radius ' + radius + ' is ' + area);
return area;
}
function Final(num) {
var num1 = halfNumber(num);
var num2 = squareNumber(num1);
var num3 = areaOfCircle(num2);
var num4 = percentOf(num3,num2);
return num4
}
Final(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment