Закрыть
Все сервисы
Главная
Лента заметок
Теги
Группы
Рейтинги

проги ' Laba # 6 'Boroday Nadya CLS DIM summ, x, n CONST eps =

3 июня´07 1:34 Просмотров: 328 Комментариев: 0
проги
' Laba # 6
'Boroday Nadya
CLS
DIM summ, x, n
CONST eps = .001
x = .45
WRITE "x= ", x, " eps= ", eps
n = 2
add = -x
summ = 1 + add
PRINT "____________________________________"
PRINT "| n | add | summ | "
PRINT "____________________________________"
PRINT USING "| ### | ##.##### | ##.###### | "; n - 1; add; summ

DO
add = -add * x / n
summ = summ + add
n = n + 1
PRINT USING "| ### | ##.##### | ##.###### | "; n - 1; add; summ
LOOP WHILE ABS(add) > eps
PRINT "____________________________________"

WRITE summ, EXP(-x)
END

' laba #7
'Boroday Nadya
CLS
DATA 5,4,9
CONST M = 1, K = 6
DIM n, a, summ, drob
summ = 0
FOR i = 1 TO 3
READ a
FOR n = M TO K
IF (n * n - 5 * n + 6) = 0 OR a = 4 THEN
PRINT "drob ne mozhet byt vichislena"
ELSE
drob = n / (a - 4) / (n * n - 5 * n + 6)
summ = summ + drob
WRITE a, n, drob, summ
END IF
NEXT
NEXT
WRITE "summ= ", summ
END


' laba #9
'Boroday Nadya
CLS
CONST N = 4
DIM slova(N) AS STRING
DATA i,Lenin,takoy,molodoy

WRITE "massiv do"
FOR i = 1 TO N
READ slova(i)
WRITE i, slova(i)
NEXT

WRITE "massiv posle zameny"
FOR i = 1 TO N
FOR j = 1 TO LEN(slova(i))
IF UCASE$(MID$(slova(i), j, 1)) = "O" THEN
MID$(slova(i), j, 1) = "A"
END IF
NEXT
WRITE i, slova(i)
NEXT
END

результаты

laba 6

"x= ",.45," eps= ",.001
____________________________________
| n | add | summ |
____________________________________
| 1 | -0.45000 | 0.550000 |
| 2 | 0.10125 | 0.651250 |
| 3 | -0.01519 | 0.636063 |
| 4 | 0.00171 | 0.637771 |
| 5 | -0.00015 | 0.637617 |
____________________________________
.6376173,.6376281

laba 7

5,1,.5,.5
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
5,4,2,2.5
5,5,.8333333,3.333333
5,6,.5,3.833333
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
9,1,.1,3.933333
drob ne mozhet byt vichislena
drob ne mozhet byt vichislena
9,4,.4,4.333333
9,5,.1666667,4.5
9,6,.1,4.599999
"summ= ",4.599999

laba 9

"massiv do"
1,"i"
2,"Lenin"
3,"takoy"
4,"molodoy"
"massiv posle zameny"
1,"i"
2,"Lenin"
3,"takAy"
4,"mAlAdAy"


Теги: qbasic
Пожаловаться
Комментариев (0)
Реклама
Реклама