CodingBat: Logics


qaytarilsin. Qolgan barcha hollarda str o`zgarishsiz qaytsin



Yüklə 275,84 Kb.
Pdf görüntüsü
səhifə6/13
tarix05.04.2023
ölçüsü275,84 Kb.
#93743
1   2   3   4   5   6   7   8   9   ...   13
CodingBat Logics (1)

qaytarilsin. Qolgan barcha hollarda str o`zgarishsiz qaytsin. 
fizzString("fig") → "Fizz" 
fizzString("dib") → "Buzz" 
fizzString("fib") → "FizzBuzz" 
17.
fizzString2 
Given an int n, return the string form of the number followed by "!". So the int 6 
yields "6!". Except if the number is divisible by 3 use "Fizz" instead of the number, 
and if the number is divisible by 5 use "Buzz", and if divisible by both 3 and 5, use 
"FizzBuzz". Note: the % "mod" operator computes the remainder after division, so 
23 % 10 yields 3. What will the remainder be when one number divides evenly into 
another? (See also: 
FizzBuzz Code
 and 
Introduction to Mod

Butun n soni berilgan, shu songa “!” belgisini qo`shib string qiymat 
qaytaring. Masalan n=6 bo`lganda, “6!” qiymat qaytarilsin. Agar berilgan 
butun son 3 ga qoldiqsiz bo`linsa “Fizz” so`zi , 5 ga qoldiqsiz bo`linsa 
“Buzz” so`zi, agarda ham 3 ga va 5 ga qoldiqsiz bo`linsa “FizzBuzz” so`zi 
n son o`rniga qaytarilsin. 
fizzString2(1) → "1!" 
fizzString2(2) → "2!" 
fizzString2(3) → "Fizz!" 
18.
twoAsOne
Given three ints, a b c, return true if it is possible to add two of the ints to 
get the third. 
Uchta a, b, c butun son berilgan, agar istalgan 2 ta sonni qo`shib 
uchinchisini olish mumkin bo`lsa true qiymat qaytarilsin
twoAsOne(1, 2, 3) → true 
twoAsOne(3, 1, 2) → true 
twoAsOne(3, 2, 2) → false 
19.
inOrder
Given three ints, a b c, return true if b is greater than a, and c is greater 
than b. However, with the exception that if "bOk" is true, b does not need to 
be greater than a. 


Uchta a, b, c butun sonlar berilgan. Agar b son a dan va c son b dan 
kata bo`lsa true qiymat qaytarilsin. Istisno sifatida agar “bOk” true 

Yüklə 275,84 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   13




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin