How to write a multiplication table in pascal?

August 28, 2016 at 19:28:31
Specs: Windows XP
we have to write a code called multiplication table using repeat... until commands. The output is supposed to be like this...
Multiplication Table
----------------------
----|----1----2----3----4----5
---------------------------------
--1--|----1----2----3----4----5
--2--|----2----4----6----8----10
and continue on to 5. the same for a size 10 table.
we prompt for the size (2 separate outputs- 5 and 10) and then print column and row headers, and the products. Thanks!!!!! #pascal

See More: How to write a multiplication table in pascal?

Reply ↓  Report •


#1
August 28, 2016 at 23:11:03
Show us what you have done so far, and explain how it isn't working. No-one is just going to do your homework for you.

Reply ↓  Report •

#2
September 2, 2016 at 10:57:13
{Sounds like you know what you are up to}
{Everything is implementation specific}
{Yet... procedures have some modularity}


var maxrow:longint;
var maxcol:longint;


procedure drawthis(x,y);
var str:string;
begin
str:=inttostr(x)+'x'+inttostr(y)+'='+inttostr(x*y);
drawtablecell(x,y,str);
{ table.cell[x,y]:=str;}
end;


procedure whileawhile; begin
{While loops are good}
row:=0;
while row<maxrow do begin
col:=0;
while col<maxcol do begin
writethis(x,y);
col:=col+1;
end;
row:=row+1;
end;
end;

procedure forfor; begin
{For loops also work}
for x:=row to maxrow do begin
for x:=col to maxcol do begin
writethis(x,y);
end;
end;
end;


begin
showmessage('What exactly is a table?');
maxrow:=random(255);
maxcol:=random(255);
drawtable(maxrows,maxcols);
whileawhile;
{forfor;}
end.


Reply ↓  Report •

Related Solutions


Ask Question