Написать программу, которая вычисляет cosx с требуемой точностью — QBasic(Бейсик)

DO
CLS
INPUT "ishem znachenie y=cos(x). vvedite x="; x
INPUT "vvedite stepen', do kotoroi schitaetsya ryad, n="; n
sum = 0
FOR i = 0 TO n
f= 1
FOR j = 1 TO i * 2 + 1
f = f/ j
NEXT
sum = sum + (-1) ^ i *f * x ^ (2 * i + 1)
NEXT
PRINT "result="; sum
PRINT "calculate machine ="; cos(x)
INPUT "povtorim? da-1, net-2  ", ask
LOOP UNTIL ask = 2
PRINT "Thank you for use the program"

Тестирование выполнено в программе QB64 ( Скачать )

Leave a Comment