keyingi o`nliklargacha yaxlitlang, misol uchun 15 yaxlitlanganda 20 bo`ladi. Agar 5 dan kichik bo`lsa 10 lar xonasigacha yaxlitlanadi. Berilgan 3 ta a, b, c sonning yig`indisini ularni yaxlitlagan holatida chiqaring. roundSum(16, 17, 18) → 60
roundSum(12, 13, 14) → 30
roundSum(6, 4, 4) → 10
Logic-2
>
closeFar
Given three ints, a b c, return true if one of b or c is "close" (differing
from a by at most 1), while the other is "far", differing from both other
values by 2 or more. Note: Math.abs(num) computes the absolute value
of a number.
uzoqYaqin Uchta a b c butun sonlar berilgan, agar b yoki c soni “yaqin”(yani a dank o`pi bilan 1 ga farq qilsa) son bo`lsa , shu hulan birga nargi son “uzoq” ya`ni qolgan ikkitasidan 2 yoki undan katta songa farq qilsa true qiymat qaytarilsin.Eslatma: sonlarni o`zaro yaxlitlash uchun Math,abs(num) matematik funksiyasidan foydalaning. closeFar(1, 2, 10) → true
closeFar(1, 2, 3) → false
closeFar(4, 1, 3) → true
Logic-2
>
blackjack
Given 2 int values greater than 0, return whichever value is nearest to 21
without going over. Return 0 if they both go over.
Chegara21 Ikkita musbat butun sonlar berilgan, agar ulardan istalgan 21 dan oshmagan holdagai eng yaqinini qayataring. Agar ikklalasi ham oshib ketgan bo`lsa 0 qiymat qaytarilsin. blackjack(19, 21) → 21
blackjack(21, 19) → 21
blackjack(19, 22) → 19
Logic-2
>
evenlySpaced
Given three ints, a b c, one of them is small, one is medium and one is
large. Return true if the three values are evenly spaced, so the difference
between small and medium is the same as the difference between
medium and large.