13-Labaratoriya
1-savol.
A va b ikkita eng katta sonning kvadratini toping. Agar eng katta raqam a bo'lsa, 1 raqamini ko'rsating, agar eng katta raqam b bo'lsa, 2 raqami.
a=int(input("1-son:"))
b=int(input("2-son:"))
if a**2>b**2:
print("1")
elif a**2print("2")
else:
print("0")
2-savol.
Berilgan intervalda y (x) funktsiya qiymatlarini h qadam bilan berilgan qadamda hisoblang:
from math import sqrt, log1p
a=0.7
x=int(input("ozgaruvchini kirit>>>"))
b=sqrt(x**3/(x+a))-log1p(x)
c=2*a*log1p(-x)
if x>0 and x<=3:
print("y=",b)
elif x<0 and x<=-2:
print("y=",c)
else:
print("y=0")
14-Labaratoriya
Misol.
Beshdan ko'p bo'lgan birinchi o'nlik sonlarning yig'indisini toping.
fun main() {
var S = 0
var count = 0
for (i in 10..100){
if (count != 15){
S += i
}else{
break
}
count++
}
println("Yeg'indi: $S")
}
15-Labaratoriya
1-savol.
A va b ikkita eng katta sonning kvadratini toping. Agar eng katta raqam a bo'lsa, 1 raqamini ko'rsating, agar eng katta raqam b bo'lsa, 2 raqami.
a=int(input("1-son:"))
b=int(input("2-son:"))
if a**2>b**2:
print("1")
elif a**2print("2")
else:
print("0")
2-savol.
Berilgan intervalda y (x) funktsiya qiymatlarini h qadam bilan berilgan qadamda hisoblang:
from math import sqrt, log1p
a=0.7
x=int(input("ozgaruvchini kirit>>>"))
b=sqrt(x**3/(x+a))-log1p(x)
c=2*a*log1p(-x)
if x>0 and x<=3:
print("y=",b)
elif x<0 and x<=-2:
print("y=",c)
else:
print("y=0")
17-Labaratoriya
1-savol.
Talabalar familiyalarini alifbo tartibida chiqaring.
fun main() {
val namesList = arrayListOf(
"BAHRIDDINOV SHODBEK XURSHIDJON O‘G‘LI",
"MAHMUDOV XABIBULLO XUSANJON O‘G‘LI",
"ISMOILOV JONIBEK LAZIZBEK O‘G‘LI",
"ABDURAXMONOV OYBEK QOBULJON O‘G‘LI",
"A’ZAMOV MUXAMMADSIDIQ FARXOD O‘G‘LI",
"JUMAYEV TEMUR TURSUNALI O‘G‘LI",
"FAYZIYEV SAMANDAR MAHMUD O‘G‘LI",
"JURAYEV SHOIRJON AMINZODA",
"AHMEDOVA SARVINOZ ABDULNOSIR QIZI",
"HUSAYNOV SHOHBOZ DODOBEKZODA",
"MAXPIRALIYEVA DILSHODAXON YO‘LDOSHALI QIZI",
"HAKIMOV ABUBAKIR OLIMJON O‘G‘LI",
"MAMATAMINOV AFZALJON RUSTAMALI-O‘G‘LI",
"SULTONAZAROV XOJIAKBAR AXRORJON O‘G‘LI",
"MO‘MINOVA NILUFARXON MUXAMMADJON QIZI",
"TO‘XTASINOV XUSANBOY DILMURODJON O‘G‘LI",
"ABDUQAYUMOV SARVARBEK ILXOMJON O‘G‘LI",
"NIZOMOV ABOSBEK BAXTIYOR O‘G‘LI",
"OLIMJONOV IQBOLJON SHUXRATJON O‘G‘LI",
"SODIQOV JASURBEK QURBONALI O‘G‘LI",
"XOLMATOV JALOLIDDIN SHAMSIDDIN O‘G‘LI",
"YO‘LDOSHEV SARDORJON SUBHONALI O‘G‘LI",
"KOMILOV SHOXJAXON ABDURASHID O‘G‘LI",
"SHOKIROV NO‘’MONJON DILSHODJON O‘G‘LI",
"USMONOV ADXAMJON RAXMONJON O‘G‘LI"
)
namesList.sort()
namesList.forEachIndexed { index, s ->
println("${index + 1}. $s")
}
}
18-Labaratoriya
1-savol.
n ta 3 xonali son kiritilsin. Keyin 1 ta 2 xonali son kiritlganda shu kiritilgan songa yaqin sonni toping.
import java.util.*
import kotlin.math.abs
import kotlin.math.min
val scanner = Scanner(System.`in`)
fun main() {
var a: Int
var b: Int
var c: Int
var i: Int
a = display("a=")
while (!check(a)){
println("Iltimos 3 xonali son kiriting!")
a = display("a=")
}
b = display("b=")
while (!check(b)){
println("Iltimos 3 xonali son kiriting!")
b = display("b=")
}
c = display("c=")
while (!check(c)){
println("Iltimos 3 xonali son kiriting!")
c = display("c=")
}
i = display("Tekshiriladigan sonni kiriting: ")
val differenceA = abs(i - a)
val differenceB = abs(i - b)
val differenceC = abs(i - c)
val min = min(min(differenceA, differenceB), differenceC)
println("Eng yaqini: ${when(min){
differenceA -> a.toString()
differenceB -> b.toString()
differenceC -> c.toString()
else -> ""
}}")
}
fun display(title: String): Int {
print(title)
return scanner.nextInt()
}
fun check(number: Int): Boolean{
return number in 100..999
}0>0>
Dostları ilə paylaş: |