QBasic. Помогите, пожалуйста! Осталось 5 программ.
QBasic. Помогите, пожалуйста! Осталось 5 программ.
Ответ(ы) на вопрос:
Гость
1.
SUB CO(A,B,C,O)
O = A
C = 0
WHILE (O > B)
O = O - B
C = C + 1
WEND
END SUB
DIM Cl%, O%
CLS
INPUT "year = "; year
CALL CO(year,100,k,O)
PRINT ; "k = "; k
CALL CO(k,3,p,O)
PRINT ; "p = "; p
CALL CO(k,4,q,O)
PRINT ; "q = "; q
m = 15 +k -p -q
PRINT ;"m = "; m
CALL CO(m,30,Cl,m1)
PRINT ; "m1 = "; m1
n = 4 +k -q
PRINT ;"n = "; n
CALL CO(n,7,Cl,n1)
PRINT ;"n1 = "; n1
CALL CO(year,19,Cl,a)
PRINT ;"a = "; a
CALL CO(year,4,Cl,b)
PRINT ;"b = "; b
CALL CO(year,7,Cl,c)
PRINT ;"c = "; c
d = 19*a+m1
PRINT ;"d = "; d
CALL CO(d,30,Cl,d1)
PRINT ;"d1 = "; d1
e = 2*b +4*c +6*d1 +n1
PRINT ;"e = "; e
CALL CO(e,7,Cl,e1)
PRINT ;"e1 = "; e1
x = 22 +d1+e1
PRINT ;"x = "; x
IF X = 57 THEN
x = 50
END IF
IF (d1=28)and(e1 = 6) THEN
k = 11*m +11
CALL CO(k,30,Cl,O)
IF O<19 THEN
x = 49
END IF
END IF
IF x>31 THEN
x = x-31
PRINT X ;" aprelia";
ELSE
PRINT x ;" marta;
END IF
END
Примечание: метод Гаусса вычисляет дату католической Пасхи.
Пример работы программы:
year = ? 2013
k = 20
p = 6
q = 4
m = 25
m1 = 25
n = 20
n1 = 6
a = 18
b = 1
c = 4
d = 367
d1 = 7
e = 66
e1 = 3
x = 32
1 aprelia
2.
DIM A%, B%, S#
CLS
INPUT "A = ", A
INPUT "B = ", B
S = 0
FOR i = A TO B
S = S + i * i
NEXT i
PRINT "S = ", S
END
3.
DIM N%, j%
CLS
INPUT "N = ", N
INPUT "K = ", K
DIM A(N)
FOR i = 1 TO N
A(i) = RND * 100
j = i
WHILE (j > K)
j = j - K
WEND
IF j = K THEN
PRINT "A(", i, ") = ", A(i)
END IF
NEXT i
END
4.
DIM M%, N%, S0%, S%
CLS
RANDOMIZE TIMER
INPUT "M = ", M
INPUT "N = ", N
DIM A%(M, N)
FOR i = 1 TO M
FOR j = 1 TO N
A(i, j) = RND * 100
PRINT A(i, j); " ";
NEXT j
PRINT
NEXT i
S = 0
FOR j = 1 TO N
S = S + A(1, j)
NEXT j
FOR i = 2 TO M
S0 = 0
FOR j = 1 TO N
S0 = S0 + A(i, j)
NEXT j
IF S < S0 THEN
S = S0
END IF
NEXT i
FOR i = 1 TO M
S0 = 0
FOR j = 1 TO N
S0 = S0 + A(i, j)
NEXT j
IF S = S0 THEN
PRINT i, ; " ";
END IF
NEXT i
5.
SUB PowerA234(A,B,C,D)
B = A*A
C = B*A
D = B*B
END SUB
DIM A%, B%, C%, D%
CLS
INPUT "A = "; A
CALL PowerA234(A,B,C,D)
PRINT ;"B = "; B
PRINT ;"C = "; C
PRINT ;"D = "; D
Не нашли ответ?
Похожие вопросы