program banyakmuncul;
uses crt;
const
sampai =10;
var
jumlah:integer;
isi: array [1..sampai] of integer;
banyak:integer;
i:integer;
x:integer;
begin
clrscr;
repeat
write('Input Jumlah Angka : '); readln(jumlah);
until jumlah<=sampai;
for i:=1 to jumlah do
begin
write(i,'. Angka : '); readln(isi[i]);
end;
writeln('');
write('Input Nilai X : '); readln(x);
banyak:=0;
for i:=1 to jumlah do
begin
if (isi[i]=x) then
begin
banyak:=banyak+1;
end;
end;
writeln('Nilai ',x,' Berjumlah ',banyak);
readln();
end.
uses crt;
const
sampai =10;
var
jumlah:integer;
isi: array [1..sampai] of integer;
banyak:integer;
i:integer;
x:integer;
begin
clrscr;
repeat
write('Input Jumlah Angka : '); readln(jumlah);
until jumlah<=sampai;
for i:=1 to jumlah do
begin
write(i,'. Angka : '); readln(isi[i]);
end;
writeln('');
write('Input Nilai X : '); readln(x);
banyak:=0;
for i:=1 to jumlah do
begin
if (isi[i]=x) then
begin
banyak:=banyak+1;
end;
end;
writeln('Nilai ',x,' Berjumlah ',banyak);
readln();
end.
0 komentar:
Posting Komentar