9 – SINF INFORMATIKA VA AXBOROT TEXNOLOGIYALARI DARSLIGIDA BERILGAN TOPSHIRIQLAR YECHIMLARI
#37.5-topshiriq
#“+”yordamida kvadrat yasang.
print('+ '*4)
print('+ '*4)
print('+ '*4)
print('+ '*4)
input()
#37.6-topshiriq
#Belgilar yordamida pingvin yasang.
print(" ~ ")
print(" - - ")
print(" (o o) ")
print(" / V \ ")
print(" /(_)\ ")
print(" ^^ ^^ ")
#38-dars 1-uy vazifasi
#1.Kutubxonaga ikkita kitob do‘konidan kitoblar keltirildi. #Birinchi do‘kondan n dona kitob keltirildi. Ikkinchi do‘kondan esa #birinchi do‘konga qaraganda k dona ko‘p kitob keltirildi. #Kutubxonaga jami qancha kitob keltirildi? Masalani yechish #dasturini tuzing. n va k kattaliklar foydalanuvchi tomonidan kiritiladi.
print('Birinchi do`kondan keltirilgan kitoblar soni n ni kiriting/')
n=int(input())
print('Ikinchi do`kondan keltirilgan ortiqcha kitoblar soni k ni liriting/')
k=int(input())
J=n+n+k
print('Jami kitoblar soni ',J,'ta')
input()
#38-dars 2-uy vazifasi
#2.Komilaga 854*89657*4587*425 amalini dasturga kiritib, #hisoblash topshirig‘i berildi. U qanday dastur tuzishi lozim?
s=854*89657*4587*425
print('s=',s)
#9-sinf IAT 41.1
#1. Tomoni a ga teng kvadrat ichiga doira chizilgan.
#Bo‘yalgan soha yuzi s ni topish dasturini tuzing.
from math import*
PI=3.14
print('kvadrat tomoni uzunligini kiriting')
a=float(input())
skv=pow(a,2)
sd=PI*pow((a/2),2)
s=skv-sd
print(s)
input()
#9-sinf IAT 41.2
#2.Foydalanuvchi tomonidan kiritilgan sondan avval va
#keyin keluvchi sonni ekranga chiqaruvchi dastur tuzing.
print('a butun son kiriting')
a=int(input())
b=a-1
c=a+1
print(b,':',c)
input()
#9-sinf IAT 41.3
#3.n nafar o‘quvchi k dona olma terdi va olmalar ular #o‘rtasida teng taqsimlandi. Qoldiq olmalar savatchaga solindi. #a)Har bir o‘quvchi qanchadan olma olgan? #b)Savatchaga qancha olma solingan?
#n va k kattaliklar foydalanuvchi tomonidan kiritiladigan
#hol uchun dastur tuzing.
print('n ni kiriting')
n=int(input())
print('k ni kiriting')
k=int(input())
t=n//k
q=n%k
print(t,q)
input()
#9-sinf IAT 41.4
#4.Foydalanuvchi tomonidan kiritilgan ikki xonalidan katta
#natural sonning oxirgi ikki raqamini topish dasturini tuzing.
print('99< a son kiriting')
a=int(input())
q=a%100
print(q)
input()
#9-sinf IAT 41.5
#5.Avtobus bir kunda n kilometr yo‘l yuradi. m kilometr #masofani bosib o‘tishi uchun avtobus necha kun yurishi #kerak? n va m kattaliklar foydalanuvchi tomonidan kiritiladi. #Masalani yechish dasturini tuzing. print('n ni kiriting')
n=int(input())
print('m ni kiriting')
m=int(input())
kun=m//n
print(kun)
#6.Chumolining bosib o‘tgan yo‘li millimetrlarda berilgan. #Uni metr, santimetr va millimetrlarda ifodalang #(masalan, 45 786 = 45 metr 78 cm 6 mm). input()
m=45786
mm=m%10
sm1=m%1000
sm=sm1//10
me=m//1000
print(me,'metr',sm,'sm',mm,'mm')
input()
#9-sinf IAT 41.7
#7.Kubning tomoni a ga teng. Kubning hajmini #topish dasturini tuzing.
print("kub qirrasi uzunligi a ni kiriting")
a=float(input())
V=a**3
print(V)
input()
#9-sinf IAT 41.8
#8.a, b, c, d sonlari berilgan. Ularning o‘rta arifmetigini
#topish dasturini tuzing.
print(' to`rtta son kiriting')
a=input().split()
a1=float(a[0])
a2=float(a[1])
a3=float(a[2])
a4=float(a[3])
ar=float((a1+a2+a3+a4))/4
print(ar)
input()
#9-sinf IAT 41.
#5-masalaga qarang
42-DARS
#1.Quyidagi mantiqiy ifodalar natijasini yozing:
print((3 > 5) and (2 > 4))
input()
print((2 < 5) and (3 > 0))
input()
print((4 > 2) or (4 < 1))
input()
print((3 > 1) or (5 > 0))
input()
#2.Quyidagi mantiqiy ifodalar natijasini toping:
#a)
a = 20
b = 28
print(a>17 and b==28)
input()
#b)
a = 20
b = 28
c=True
print(a>17 and b>22 and c)
44-DARS
#1.Mantiqiy ifodalar qiymatini aniqlash uchun #dastur tuzing va natijasini oling: a=8
b=a**3
print(ainput()
a=10
b=a*3
print(a<=b/3)
input()
a=8
b=a
c=(a+b==2*b)
print(c)
input()
a=8
b=a-4
print((a+3)>=(b-2))
input()
#3.Mantiqiy ifodalar natijasini toping:
a = 20
c = False
d=a > 17 or c
print(d)
input()
a = 20
c = False
d=not a > 17 or not c
print(d)
#2.Mantiqiy ifodalar qiymatini aniqlang:
a=(1 > 3) or (4 < 0)
b=not (5 > 6)
print(b)
c=not (6 > 5)
print(c)
d=(2 == 0) or (2 != 2)
print(d)
e=(2 == 0) and (2 > 0)
print(e)
f=(3 > 0) or (2 > 0)
print(f)
a = True
b = True
c = False
d=(not(a and c) and (a or b) or c)
print(d)
a = 66
b = 22
c = 7
d=not((a > b) or (b < c))
print(d)
#4.Mantiqiy ifodalar qiymatini aniqlash uchun
#dastur tuzing va natijasini oling:
a=int(input("a="))
b=(a<=5 or a>=0 and a<3)
print(b)
input()
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
x=int(input("x="))
y=int(input("y="))
d=(x**2+y>0 and a==0.1 or (b>3.7 and c!=4))
print(d)
input()
a=int(input("a="))
b=int(input("b="))
s=(a<1 or a>0 or not (x*x+x*x<=1))
print(s)
input()
d=not(not(not(a>b) or True) and False)
print(d)
46-DARS
#1.Ikkita a va son berilgan. Agar b son a sondan
#kichik bo‘lsa, u holda b ni nol bilan almashtiruvchi,
#aks holda b ni o‘zgarishsiz qoldiruvchi dastur tuzing.
#46-dars 1-topshiriq
a=int(input('a='))
b=int(input('b='))
if ab=0
print('b=',b)
input()
#46-dars 2-topshiriq
#2.Berilgan a butun son noldan farqli b butun songa
#qoldiqsiz bo‘linishi yoki bo‘linmasligini aniqlovchi
#dastur tuzing.
a=int(input('a='))
b=int(input('b='))
c=a%b
if c==0:
print(a, ' soni', b, ' soniga qoldiqsiz bo`linadi')
else:
print(a, ' soni', b, ' soniga qoldiqsiz bo`linmaydi')
input()
#46-dars 3-topshiriq
#3.Berilgan a butun son noldan farqli b butun songa #qoldiqsiz bo‘linsa, bu ikkala sonning yig‘indisini, #aks holda ko‘paytmasini topish dasturini tuzing.
a=int(input('a='))
b=int(input('b='))
c=a%b
if c==0:
d=a+b
else:
d=a*b
print(d)
input()
#46-dars 4-topshiriq
#4.Uchta a, b va c son berilgan. Agar a2 – b2 = c2 #shart bajarilsa, ularning ko‘paytmasini, aks holda #yig‘indisini hisoblovchi dastur tuzing.
a=int(input('a='))
b=int(input('b='))
c=int(input('c='))
if a*a-b*b==c*c:
p=a*b*c
print(p)
else:
s=a+b+c
print(s)
input()
#46-dars 5-topshiriq
5.Butun son berilgan. Agar u musbat bo‘lsa, unga 1 #sonini qo‘shish, aks holda o‘zini chiqarish dasturini tuzing.
a=int(input('a='))
if a>0:
a=a+1
print('a=',a)
input
#46-dars 6-topshiriq
6.Kiritilgan butun son musbat bo‘lsa, uning 10 ga ko‘paytmasini,
#aks holda o‘zini chiqaruvchi dastur tuzing.
a=int(input('a='))
if a>0:
a=a*10
else:
a=a
print('a=',a)
47-dars. TARMOQLANUVCHI ALGORITMLARNI DASTURLASH. #ELIF OPERATORI
#1. Ikki xonali sonning raqamlari toq
#ekanligini aniqlovchi dastur tuzing.
#47-dars 1-misol
a=int(input('bi='))
b=a//10
i=a%10
if b%2!=0 and i%2!=0:
print('raqamlar toq',b,':',i)
else:
print(' raqamlar toq emas',b,':',i)
input()
#47-dars 2-misol
#2. Uch xonali sonda bir xil raqamlar #mavjudligini aniqlovchi dastur tuzing.
print('uch xonali son kriting')
a=int(input('a='))
b=a%10
i=b%10
u=i%10
if b==i or i==u or b==u:
print('bir hil raqamlar mavjud')
else:
print('bir hil raqamlar mavjud emas')
input()
#47-dars 3-misol
#3.a va b sondan qaysi biri juft
#ekanligini aniqlovchi dastur tuzing.
a=int(input('a='))
b=int(input('b='))
a1=a%10
a2=b%10
if a1%2==0:
print('a soni juft',a)
if a2%2==0:
print('b soni juft',b)
input()
#47-dars 4-misol
#4.3 ta butun son kiritildi. Qaysi biri juft #ekanligini aniqlovchi dastur tuzing.
a=int(input('a='))
b=int(input('b='))
c=int(input('c='))
a1=a%10
a2=b%10
a3=c%10
if a1%2==0:
print('a soni juft',a)
if a2%2==0:
print('b soni juft',b)
if a3%2==0:
print('c soni juft',c)
1>
Do'stlaringiz bilan baham: |