Masalani echish algoritmini blok-sxemasini chizish (2-rasm) :
2-Rasm.
Masalani echish algoritmini dasturlash muhitida bajartirish.
3-topshiriq
Masalaning qo’yilishi: ni hisoblash;
Masalaning matematik modelini qurish: ;
Masalani echish algoritmini tuzish:
M, K sonlarni kiritish;
S ning boshlang’ich qiymatini kiritish : S=0;
Takrorlash parametri n ga 1 ga teng qiymat berilsin;
n parametrning qiymati tekshirilsin. Agar n ning qiymati m dan katta bo‘lsa, 9- qadamga o‘tilsin;
S = S+ hisoblansin;
n parametrning qiymati bir birlikga oshirilsin (n = n+ 1);
4-qadamga o’tilsin;
Natijani olish (S);
Tamom.
Masalani echish algoritmini dasturlash muhitida bajartirish:
Masalani echish algoritmini blok-sxemasini chizish (3-rasm):
3-Rasm.
4-topshiriq
Masalaning qo’yilishi: Bilik sanoq sistemasida berilgan sonni bittaga oshiruvchi TM mashinasi dasturi tuzilsin.
TM dasturi:
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
^
|
q1
|
0 → q1
|
1 → q1
|
2→ q1
|
3 → q1
|
4 → q1
|
5 → q1
|
6 → q1
|
7→ q1
|
8 → q1
|
9 → q1
|
← q2
|
q2
|
1T!
|
2T!
|
3T!
|
4T!
|
5T!
|
6T!
|
7T!
|
8T!
|
9T!
|
^ ←
|
1T!
|
Dasturni TM kompyuter modelida bajarish:
PM dasturi:
|
?
|
5,3
|
Joriy katak belgilangan bo’lsa,5-qadam, aks holda 4-qadam bajarilsin
|
|
→
|
1
|
Bir katak chapga siljib, 1-qadam bajarilsin
|
|
?
|
4,2
|
Joriy katak belgilangan bo’lsa,4-qadam, aks holda 2-qadam bajarilsin
|
|
→
|
5
|
Bir katak chapga siljib, 5-qadam bajarilsin
|
|
?
|
6,7
|
Joriy katak belgilangan bo’lsa,6-qadam, aks holda 7-qadam bajarilsin
|
|
V
|
7
|
Joriy katak belgilansin va 7-qadamga o’tilsin
|
|
!
|
|
Tamom
|
Dasturni PM kompyuter modelida bajarish:
MNA dastturi:
|
*0
|
→
|
0*
|
9.
|
*8
|
→
|
8*
|
17.
|
3*
|
→
|
4.
|
25.
|
4?
|
→
|
5.
|
|
*1
|
→
|
1*
|
10.
|
*9
|
→
|
9*
|
18.
|
2*
|
→
|
3.
|
26.
|
5?
|
→
|
6.
|
|
*2
|
→
|
2*
|
11.
|
9*
|
→
|
?0
|
19.
|
1*
|
→
|
2.
|
27.
|
6?
|
→
|
7.
|
|
*3
|
→
|
3*
|
12.
|
8*
|
→
|
9.
|
20.
|
0*
|
→
|
1.
|
28.
|
7?
|
→
|
8.
|
|
*4
|
→
|
4*
|
13.
|
7*
|
→
|
8.
|
21.
|
0?
|
→
|
1.
|
29.
|
8?
|
→
|
9.
|
|
*5
|
→
|
5*
|
14.
|
6*
|
→
|
7.
|
22.
|
1?
|
→
|
2.
|
30.
|
9?
|
→
|
?0.
|
|
*6
|
→
|
6*
|
15.
|
5*
|
→
|
6.
|
23.
|
2?
|
→
|
3.
|
31.
|
?0
|
→
|
10.
|
|
*7
|
→
|
7*
|
16.
|
4*
|
→
|
3.
|
24.
|
3?
|
→
|
4.
|
32.
|
|
→
|
*
|
Dasturni MNA kompyuter modelida bajarish:
Do'stlaringiz bilan baham: |