Membuat tabel perkalian pada program turbo pascal dan turbo C++ dengan menggunakan perintah " while " dan " repeat - until ".
Pascal => while
uses crt;
var a,b,x,y,z:integer;
begin
clrscr;
write('berapa baris : '); readln(a);
write('berapa kolom : '); readln(b);
x:=1;
while x<=a do
begin
y:=1;
while y<=b do
begin
z:=x*y;
write(z:4);
y:=y+1;
end;
writeln;
x:=x+1;
end;
readln;
end.
Pascal => repeat - until
uses crt;
var a,b,x,y,z:integer;
begin
clrscr;
write('berapa baris : '); readln(a);
write('berapa kolom : '); readln(b);
x:=1;
repeat
y:=1;
repeat
z:=x*y;
write(z:4);
y:=y+1;
until y>b;
writeln;
x:=x+1;
until x>a;
readln;
end.
C++
#include
void main()
{
cout<<"berapa baris : "; int x; cin>>x; endl;
cout<<"berapa kolom : "; int y; cin>>y; endl;
int a;
a=1;
while(a<=x)
{
int b;
b=1;
while(b<=y)
{
cout<<<" ";
b++;
}
cout<
a++;
}
}