Darvozaning eni metr, bo‘yi esa metr: #1) darvoza yuzasi (S)ni hisoblash dasturini tuzing


Download 40.09 Kb.
bet6/10
Sana30.04.2023
Hajmi40.09 Kb.
#1408293
1   2   3   4   5   6   7   8   9   10
Bog'liq
9-sinf inf

#51-dars 2-mashq
#2.1 dan n gacha bо‘lgan natural sonlar kvadratlari yig‘indisini #aniqlovchi dastur yozing.
n=int(input('n=')) s=0

for i in range(1,n+1): k=i*i
s=s+k print(s) input()
#51-dars 3-mashq
#3.n>=2 shartni qanoatlantiruvchi n soni berilgan. Ushbu ifodani #hisoblovchi dastur tuzing. d=1*2+2*3+...+(n–1)*n
#print('n>=2 shartni bajaruvchi sonni kiriting') d=0
n=int(input('n='))
for n in range(2,n+1): k=(n-1)*n
d=d+k print(d) input()
#51-dars 4-mashq
#4.Bir nechta son berilgan. Ular orasida qancha 2 soni bor ekanligini #aniqlovchi dastur tuzing.
print('Nechta son kiritasiz?') a=int(input('a='))

s=0

for i in range(a): print('sonni kiriting') n=int(input('n='))

if n==2: s=s+1
print(s,'ta 2 raqami mavjud') input()
#51-dars 5-mashq
#5.S=11+13+15+…+49 yig‘indini hisoblash dasturini tuzing. s=0
for i in range(11,49,2): s=s+i
print('s=',s) input()
#51-dars 6-mashq. Va nihoyat juda sodda holda chidi

#6. n ta uchburchakni ekranga chiqaruvchi dastur tuzing. n –1 #dan 9 gacha bо‘lgan natural sonlarni qabul qiladi.

n=int(input('n='))
for i in range(1,n+1): print(' * ')
print(' * * ')
print(' * * * ')
print('* * * *')

#52 dars 1-mashq

#1.Butun son kiritilgan vaqtda sondan avval va keyin #keluvchi sonni chiqaruvchi dastur tuzing. Dastur #natijasi quyidagicha bo‘lishi lozim.

#Kiruvchi ma’lumot Chiquvchi ma’lumot # 254 254 dan avvalgi son bu – 253 # 254 dan keyingi son bu – 255
a=int(input('a=')) b=a-1

c=a+1

print(a," dan avvalgi son-",b) print(a," dan keyingi son-",c) input()
#52 dars 2-mashq

#2.Natural son berilgan. Shu son oxirgi raqamini #topish dasturini tuzing.

Download 40.09 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling