oke kita mulai dari program yang paling simple:
1. Program Mod.
program mod;
uses wincrt;
var
A,B, hasil:integer;
begin
readln(A);
readln(B);
hasil:= A mod B;
writeln(hasil);
end.
uses wincrt;
var
A,B, hasil:integer;
begin
readln(A);
readln(B);
hasil:= A mod B;
writeln(hasil);
end.
2. Program
program pelajar;
uses wincrt;
var
i:integer;
begin
i := -9;
REPEAT
i := i + 1;
writeln(i);
until i= 1 ;
end.
uses wincrt;
var
i:integer;
begin
i := -9;
REPEAT
i := i + 1;
writeln(i);
until i= 1 ;
end.
buat yang medium satu yuk
1. Program Modus
program modus;
uses wincrt;
var i,n,j,modus:integer;
A,muncul:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
readln(A[i]);
writeln;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
if A[i]=A[j] then
muncul[i]:=frek[i]+1;
end;
modus:=1;
for i:=1 to n do
begin
write(muncuk[i],' ');
if muncul[modus]<muncul[i] then
modus:=i;
end;
write('modus: ',A[modus],' sebanyak ',muncul[modus]+1);
end.
Tidak ada komentar:
Posting Komentar
Bagi pikirannya yang masih acakadut,,
silahkan coment disini
thx,,,