for i in range(1,n+1): b=a//(10**(i-1))%10 if b%2==0:
j+=1
print(j,'ta juft raqam bor')
input()
#54-dars 6-mashq
#6.n natural soni berilgan. 1 dan n gacha bo‘lgan #natural sonlar ichida oxirgi raqami 3 gа karrali #sonlarni chiqaruvchi dastur tuzing.
a = int(input('Sonni kiriting: '))
for i in range(1,a): b=i%10
if b%3==0 and b!=0: print(i)
#1. Qo‘shish, ayirish, ko‘paytirish va bo‘lish #amallaridan iborat sodda kalkulyator dasturini tuzing.
#55-dars 1-masala a=int(input('a ni kiriting, a=')) b=int(input('b ni kiriting, b='))
print('amalni kiriting va enterni bosing') amal=input('+ - * /')
if amal=='+': c=a+b
elif amal=='-': c=a-b
elif amal=='*': c=a*b
elif amal=='/': c=a/b
else:
c=(' AMAL XATO!')
print('natija c=',c)
#2.Foydalanuvchi tomonidan kiritilgan sonlar #yig‘indisini hisoblash dasturini tuzing. Agar
#manfiy son kiritilsa, sikl o‘z ishini to‘xtatishi lozim.
while True: a=int(input('a='))
b=int(input('b=')) if a>=0 and b>=0:
s=a+b print('s=',s)
else:
break
# 56-dars 1-misol
#n va k butun musbat sonlar berilgan. n va k #qatnashgan ushbu ifodani hisoblang. #n!/k!(n-k)! Funksiyadan foydalaning.
def factorial(n): if n==0:
return 1 else:
natija=n*factorial(n-1) return natija
n=int(input('n= '))
k=int(input('k= ')) m=n-k N=factorial(n) K=factorial(k) M=factorial(m) S=N/(K*M)
print('natija=',S)
#56-dars 2-masala
#n natural son berilgan. Kvadrati n dan kichik #bo‘lgan barcha natural sonlarni chiqaruvchi #dastur tuzing.
from math import* i=1
n=int(input('n= '))
m=int((sqrt(n))) while i<=m:
print(i) i+=1
#56-dars 3-masala
#3.Bir birlik uzunlik ‘-’ ga teng. Berilgan n #uzunlikdagi ‘-’ belgidan iborat chiziq chizuvchi #dastur tuzing. Protseduradan foydalaning.
print('nechta _ belgisi qo`yilsin? a=') a=int(input())
Do'stlaringiz bilan baham: |