Составить блок-схему и написать программу для Qbasic. Процентные ставки по вкладам до 10 тыс. руб. составляют 4% , по вкладам от 10 до 50 тыс. руб. – 9%, свыше 50 тыс. руб. – 12% . Рассчитать сумму процентов по вкладу размером Х руб. Вариант
Uses Crt; const n=10; var a,b:array[1..n] of integer; i,k,t:integer; begin ClrScr; Randomize; for i:=1 to n do begin a[i]:=Random(50); Write(a[i],' ') end; Writeln; for i:=1 to n do begin b[i]:=Random(50); Write(b[i],' ') end; Writeln; Write('k t='); Read(k,t); for i:=1 to n do begin if a[i]>t then a[i]:=a[i]+4; Write(a[i],' ') end; Writeln; for i:=1 to n do begin if b[i]>10*k then b[i]:=b[i]+k; Write(b[i],' ') end; Readkey end.
var mas1, mas2: array[0..9] of integer; t, k, i, j: integer; begin readln(t); readln(k); for j := 0 to 1 do begin if (j = 1) then writeln(); for i := 0 to 9 do begin if(j = 0) then begin mas1[i] := random(100); write(mas1[i], ' '); if mas1[i] > t Then mas1[i] := mas1[i] + 4; end else begin mas2[i] := random(100); write(mas2[i], ' '); if mas2[i] > 10 * K Then mas2[i] := mas2[i] + K; end; end; for i := 0 to 9 do if (j = 0) then write(mas1[i]) else write(mas2[i]); writeln(); end; readln(); end.
const
n=10;
var
a,b:array[1..n] of integer;
i,k,t:integer;
begin
ClrScr;
Randomize;
for i:=1 to n do begin
a[i]:=Random(50);
Write(a[i],' ')
end;
Writeln;
for i:=1 to n do begin
b[i]:=Random(50);
Write(b[i],' ')
end;
Writeln;
Write('k t='); Read(k,t);
for i:=1 to n do begin
if a[i]>t then a[i]:=a[i]+4;
Write(a[i],' ')
end;
Writeln;
for i:=1 to n do begin
if b[i]>10*k then b[i]:=b[i]+k;
Write(b[i],' ')
end;
Readkey
end.
Тестовое решение:
1 6 23 12 47 1 44 24 6 18
31 30 30 29 0 3 43 32 46 21
k t=2 20
1 6 27 12 51 1 48 28 6 18
33 32 32 31 0 3 45 34 48 23
begin
readln(t);
readln(k);
for j := 0 to 1 do begin
if (j = 1) then writeln();
for i := 0 to 9 do begin
if(j = 0) then begin
mas1[i] := random(100);
write(mas1[i], ' ');
if mas1[i] > t Then mas1[i] := mas1[i] + 4;
end
else
begin
mas2[i] := random(100);
write(mas2[i], ' ');
if mas2[i] > 10 * K Then
mas2[i] := mas2[i] + K;
end;
end;
for i := 0 to 9 do
if (j = 0) then
write(mas1[i])
else
write(mas2[i]);
writeln();
end;
readln();
end.
))