Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function start(){
- var operation = readLine("What operation do you want to use? ");
- if(operation == "circumference"){
- var radius = readLine("What is the radius? ");
- var circumference = (radius * radius) * 3.14;
- println("The circumference is " + circumference);
- }else if(operation == "squareroot"){
- var number = readLine("Choose a number to square root. ");
- var sqrt = Math.sqrt(number);
- println("The square root of " + number + " is " + sqrt);
- }else if(operation == "hypotenuse"){
- var leg1 = readInt("What is the first leg? ");
- var leg2 = readInt("What is the second leg? ");
- var hypotenuse = (leg1 * leg1) + leg2 * leg2;
- println("The hypotenuse is " + hypotenuse );
- }
- }
Add Comment
Please, Sign In to add comment