MarcinKrol

Zad 11 - JS

Nov 24th, 2020
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. const ageFirst = prompt('Podaj wiek pierwszej osoby:') * 1;
  2. const ageSecond = prompt('Podaj wiek drugiej osoby:') * 1;
  3.  
  4. if (ageFirst > 100 && ageSecond > 100){
  5. alert(`Gratulacje! Przeżyliście ${ageFirst} i ${ageSecond} lat!`)
  6. }
  7.  
  8. else if (ageFirst > ageSecond){
  9. document.write(`Osoba pierwsza jest starsza niż osoba druga o ${ageFirst - ageSecond} lat`);
  10. }
  11. else if (ageSecond > ageFirst){
  12. document.write(`Osoba druga jest starsza niż osoba pierwsza o ${ageSecond - ageFirst} lat`);
  13. }
Add Comment
Please, Sign In to add comment