Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const boki = []
- for(let i = 0; i < 3; i++)
- boki[i] = Number(prompt(`Podaj bok nr. ${i + 1}`, 0))
- boki.sort((a, b) => a - b).reverse()
- if(boki[0] < boki[1] + boki[2])
- document.write(`Obwód trójkąta o bokach ${boki.join(' ')} wynosi ${boki.reduce((suma, bok) => suma + bok)}`)
- else document.write(`Z boków ${boki.join(', ')} nie można skonstruować trójkąta`)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement