Last active
October 9, 2019 03:34
-
-
Save ideacco/f2b2a1a9aa7a49b71aeb1e7b080ea6f9 to your computer and use it in GitHub Desktop.
根据给出的椭圆形长宽值求椭圆的周长
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function yuan (a,b){ | |
let c=(a+b)*3 | |
let d= (3*a+b)*(a+(3*b)) | |
let e = Math.sqrt(d) | |
let f= c-e | |
return Math.PI * (f/2) | |
} | |
// 参考链接 https://zh.wikipedia.org/wiki/%E6%A4%AD%E5%9C%86 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//根据输入的 周长和长宽比输出椭圆形的长宽值 | |
function yuan (c,k){ | |
let bb = 3*(1+k) | |
let ff = (3*k+1)*(k+3) | |
let ee = Math.sqrt(ff) | |
let pi = Math.PI*(bb-ee) | |
console.log('长度值:',(c/pi)*k) | |
console.log('宽度值:',c/pi) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment