program pola;
uses wincrt;
var
i,n,j:integer;
a:string;
begin
write ('buat pola hingga baris ke_');
readln(n);
writeln ;
for i:=1 to n do
begin
for j:=1 to i do
begin
if (j mod 2)=1 then
a:='*' else a:='1';
write(a, ' ');
end;
writeln;
end;
end.
program faktorial;
uses wincrt;
var i, N, jumlah: integer;
begin
jumlah:=1;
write('masukkan nilai: ');
readln(N);
write('faktorial dari',N,'adalah=');
for i:=N downto 2 do
begin
write(i,'x');
jumlah:=i* jumlah;
end;
begin
if N<0 then write ('tidak terdefinisi')
else write('1','=',jumlah);
end;
end.
program pola;
uses wincrt;
var
i,j,n,a:integer;
begin
write ('tulis hingga suku ke n_');
readln (n);
a:=0;
for i:=1 to (n div 4)+1 do
begin
for j:= 1 to 4 do
begin
a:=a+1;
if a<= n then
write (a,' ')
else write (' ');
end;
writeln;
end;
end.
program pola;
uses wincrt;
var
i,n,j:integer;
begin
readln (n);
for i:=1 to n do
begin
for j:=1 to n do
begin
if (j<i) then
write (' ')
else
write ('*');
end;
writeln;
end;
end.
Tidak ada komentar:
Posting Komentar