Advertisement
wiktormadera

Zad12JS

Nov 27th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const boki = []
  2.  
  3. for(let i = 0; i < 3; i++)
  4.     boki[i] = Number(prompt(`Podaj bok nr. ${i + 1}`, 0))
  5.  
  6. boki.sort((a, b) => a - b).reverse()
  7.  
  8. if(boki[0] < boki[1] + boki[2])
  9.     document.write(`Obwód trójkąta o bokach ${boki.join(' ')} wynosi ${boki.reduce((suma, bok) => suma + bok)}`)
  10. 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