9 – SINF INFORMATIKA VA AXBOROT TEXNOLOGIYALARI DARSLIGIDA BERILGAN TOPSHIRIQLAR YECHIMLARI
#28-dars masalalari
#1. Darvozaning eni 4 metr, bo‘yi esa 3 metr:
#1) darvoza yuzasi (S)ni hisoblash dasturini tuzing;
#2) darvoza qirrasining uzunligi (P)ni hisoblash dasturini tuzing.
e=4#m
b=3#m
#1)
S=e*b
print('S=',S,'mert kadrat')
#2)
P=2*(e+b)
print('P=',P,'metr')
#2.Ikkita qayiq turg‘un suvda bir-biriga tomon 4 km/soat va
#2 km/soat tezlik bilan suzmoqda. Ular orasidagi masofa 24 km bo‘lsa:
#1) ular qancha vaqtdan keyin uchrashadi?
#2) qancha vaqtdan keyin ular orasidagi masofa 12 km ni tashkil etadi?
v1=4 #km/soat
v2=2 #km/soat
S=24 #km
v=v1+v2
#1) S=v*t. t=S/v. v=v1+v2
3 t=S/v
print('t=',t,' soat')
#2) S1=24-12=12 km
S1=12 #km
t1=S1/v
print('t1=',t1,'soat')
#3.Doiraning radiusi 4 metrga teng (PI=3.14):
#1)doira yuzini hisoblang;
#2)aylana uzunligini hisoblang.
#1)
pi=3.14 #s=pi*r*r
r=4 #metr
s=pi*r*r
print('s=',s,'metr kvadrat')
#2) l=2*pi*r
l=2*pi*r
print('l=',l,'metr')
# 30 dars masalalari
#1.Darvozaning eni va bo‘yi foydalanuvchi tomonidan kiritiladi #1)darvoza yuzasini hisoblash dasturini tuzing;
#2)darvoza qirrasining uzunligini hisoblash dasturini tuzing.
a=int(input('Bo`yi = '))
b=int(input('Eni= '))
#1)
#S=a*b
#print('S=',S)
#2)
P=2*(a+b)
print('P=',P)
#2.Quyidagi o‘zgaruvchilar turini aniqlang:
#alfa = 8764; beta = ‘Lola’ son=30.2
#alfa=8764
#print(type(alfa))
#beta='Lola'
#print(type(beta))
son=39.2
print(type(son))
#3. O‘zgaruvchi uchun qiymat kiritilganda, uning turini
#aniqlovchi dastur tuzing.
a=input('a=')
print(type(a))
#31-dars mashqlari
#1.Quyidagi o‘zgaruvchilar turini aniqlang: #alfa = 579413; beta = 'Aqlbek'; d = True; #s = 0; resp = ’d’; b = 100; max = False; #fc = ’True34’; t = 102.5; res = ’2500’; #a = ’-50’; b = 45.67
alfa=579413
#3print(type(alfa))
#x=input()
#beta='Aqlbek'
#print(type(beta))
#x=input()
#d=True
#print(type(d))
#x=input()
#t=102.5
#print(type(t))
#2.Ikkita qayiq turg‘un suvda bir-biriga #tomon a km/soat va b km/soat tezlik bilan #suzmoqda. Ular orasidagi masofa S km bo‘lsa, #ular qancha vaqtda uchrashadi? a va b #foydalanuvchi tomonidan kiritiladi.
#v1=int(input('birinchi qayiqning tezligi='))
#v2=int(input('ikkinchi qayiqning tezligi='))
#S=int(input('Oralaridagi masofa='))
#v=v1+v2
#S=v*t. t=S/v. v=v1+v2
#t=S/v
#print('t=',t,' soat')
#3.Xonaning bo‘yi (x) va eni (y) metr
#foydalanuvchi tomonidan kiritiladi.
#Xonaning yuzasi (S) va perimetri
#(P)ni topish dasturini tuzing.
#a=int(input('a='))
#b=int(input('b='))
#1)
#S=a*b
#print('S=',S,'mert kadrat')
#x=input()
#2)
#P=2*(a+b)
#print('P=',P,'metr')
#6.Doiraning radiusi r ga teng.
#Doiraning yuzi (s) va aylana uzunligi
• l ni topish dasturini tuzing. Doiraning #radiusi foydalanuvchi tomonidan kiritiladi #(PI=3.14).
#1)pi=3.14 #s=pi*r*r
pi=3.14
r=int(input('r='))
s=pi*r*r
print('s=',s,'metr kvadrat')
#2) l=2*pi*r
x=input()
l=2*pi*r
print('l=',l,'metr')
#1.Berilgan a va b sonlari yig‘indisi, ko‘paytmasini #toping. Yig‘indi va ko‘paytma oxirgi raqamlarining #ko‘paytmasini topish dasturini tuzing.
#33-dars masalalari #Berilgan Ifoda
Natija
# a = 8 d = a + b = 8 + 9 =17 S=7*2=14
6. b = 9 c = a * b = 8 * 9 = 72 #a=8
#b=9
#d=a+b
#print("d=",d)
#c=a*b
#print("c=",c)
#x=d%10
#print(x)
#y=c%10
#print(y)
#S=x*y
#print("S=",S)
#2.Berilgan ikki xonali son xonalarining yig‘indisini #hisoblash dasturini tuzing.
#print("ikki xonali son kiriting")
#x=int(input())
#a=x//10
#b=x%10
#S=a+b
#print("S=",S)
#3.Quyidagi ifodani Python tilida yozing:
#1)x + 2y + 52 * 4–58
x+2*y+(5**2)*4-58
#2)256+(2589–1549)*458+45614–4565/5
256+(2589-1549)*458+456**14-4565/5
#35-dars masalalari
#1.Hovuzning bo‘yi 6 metr, eni 4 metr va #chuqurligi 3 metr. Berilganlar asosida #quyidagi topshiriqlar uchun dastur tuzing: #a)Hovuz ichiga kafel qoplash uchun qancha #kvadrat metr kafel kerak bo‘ladi? #b)Hovuzni to‘ldirish uchun qancha litr suv #kerak bo‘ladi (1 l = 1000 cm3)?
#a=6#metr
#b=4#metr
#c=3#metr
#s=a*b+2*b*c+2*a*c
#print("Kafel qoplash uchun",s,"kvadrat metr maydon")
#v=a*b*c
#print("v=",v*1000,"litr")
#2.Yuqoridagi masalada hovuz bo‘yi, eni va #chuqurligi kattaliklari foydalanuvchi #tomonidan kiritiladigan hol uchun #dastur tuzing.
#print("Hovuzning bo`yi a")
#a=int(input())
#print("hovuzning eni b")
#b=int(input())
#print("Hovuzning chuqurligi")
#c=int(input())
#s=a*b+2*b*c+2*a*c
#print("Kafel bosiladigan yuza",s,"metr kvadrat")
#v=a*b*c
#print("Hovuzning hajmi",v*1000,"litr")
#3.10 288 sekundni soat, minut va
#sekundlarda ifodalang.
#t=10288 #sekund
#tm=t/60#minut
#ts=tm/60#soat
#print("t=",t,"sek=",tm,"min=",ts,"soat")
#4.Berilgan ikki xonali son xonalarining #ko‘paytmasini hisoblash dasturini tuzing.
#a=int(input('a='))
#b=a//10
#c=a%10
#kupaytma=b*c
#print("kupaytma",kupaytma)
#5.Berilgan uch xonali son xonalarining #yig‘indisi va ko‘paytmasini hisoblash #dasturini tuzing.
#Berilgan Ifoda Natija
# 897 8+9+7 24
z: 8*9*7 504
print("Uch xonali son kiriting")
a=int(input())
print(a)
br=a//100
print("birinchi raqam-",br)
iir=a//10
ir=iir%10
print("ikkinchi raqam",ir)
ur=a%10
print("uchinchi raqam",ur)
s=br+ir+ur
p=br*ir*ur
print("Raqamlar yig`indisi-",s)
print("Raqamlar ko``paytmasi-",p)
#6.Qisqartirilgan amallarni qo‘llagan holda, #quyidagi dastur natijasini chiqaring.
#Berilgan Ifoda Natija
3. a=8 a=int(input())
4. b=5 b=int(input())
5. c=9 c=int(input())
6. a-=b
7. a*=c
8. a+=(b*c+b)
9. print(a)
print('Butun a ni kiriting')
a=int(input())
print('Butun b ni kiriting')
b=int(input())
print('Butun c ni kiriting')
c=int(input())
a-=b
print(a)
a*=c
print(a)
a+=(b*c+b)
#7. Quyidagi ifodani Python tilida yozing:
y= 7
x2+x+1+x2
#y=7/(x*x+x+1)+x*x
#37.1-topshiriq
#1. “GULTOJIXO‘ROZ” so‘zidan qism so‘zlar
#ajratuvchi dastur tuzing.
a='GULTOJIXO`ROZ'
b=a[:3]
print(b)
c=a[3:7]
print(c)
d=a[7:13]
print(d)
input()
#37.2-topshiriq
#2.TUZAMAN, PYTHON, DASTUR, TILIDA, MEN.
#Ushbu so‘zlardan jumla tuzuvchi dastur tuzing.
A='TUZAMAN'
B='PYTHON '
C='DASTUR '
D='TILIDA '
E='MEN '
P=E+B+D+C+A
print(P)
input()
#37.3-topshiriq
#3.Foydalanuvchi tomonidan kiritilgan matn #uzunligini aniqlovchi dastur tuzing.
print('Matn kiriting')
a=str(input())
print("siz kritgan matnda ",len(a),'ta belgi bor.')
input()
#37.4-topshiriq
#“*” lar yordamida uchburchak yasang.
print(' * ')
print(' * * ')
print(' * * * ')
print('* * * *')
input()
Do'stlaringiz bilan baham: |