Solved How to make this multiplication table in pascal

November 23, 2012 at 09:41:09
Specs: Windows 7

1 2 3 4 5
2 3 6 8 10
3 6 9 12 15
4 8 12 16 20

See More: How to make this multiplication table in pascal

Report •


✔ Best Answer
November 24, 2012 at 23:55:16

your loops have no ends, ("end;"), the loops aren't nested, so you get nothing from statement "j=i*i", for your purposes i squared is not the object. You need loop (J) inside of bigger loop (i), and compute their extension (multiply j*i).


#1
November 23, 2012 at 13:27:20

Since it's homework exercise, I won't make this answer explicit. I would use a 2-dimensional array and a nested set of for-loops to load it with values based on the indexes of the respective loops (outer loop goes to prime axis (1-dimensional), inner loop covers secondary axis which is two-dimensional.

Report •

#2
November 23, 2012 at 13:36:46

not being an expert at pascal i found this link, which may help

http://www.computing.net/answers/pr...

However, my concern is that the 3(which it seems like should be a four) in the second row doesn't seem to match the pattern...was this an error? Or did I miss the pattern.

:: mike


Report •

#3
November 23, 2012 at 15:58:39

I'm sorry, you're right it should be a four. I guess I was typing to fast!

The link did help a bit, but since this is a homework assignment and we didn't get to CLRSCR or CRT; I can't use it.

Also what it bugging me is that my table doesn't go 1 t 5 both ways. It goes 1 to 5 across and 1 to 4 down.


Report •

Related Solutions

#4
November 23, 2012 at 16:01:19

Can you explain this more?

Report •

#5
November 23, 2012 at 16:06:38

24 hours for OP's code, working or not, or the thead's deleted.

How To Ask Questions The Smart Way


Report •

#6
November 23, 2012 at 16:10:21

I'm sorry. I don't understand.

Report •

#7
November 23, 2012 at 16:52:01

I'm saying this site discourages cheating by having us do your homework. I expect you to show your work, by posting the code you wrote. Your program doesn't need to to work (if it did you wouldn't be asking us), but it does have to show you're trying to work though the assignment, and not working us for your grade.

How To Ask Questions The Smart Way


Report •

#8
November 24, 2012 at 18:35:50

Okay this is my code so far. I know I'm completly wrong but I tried anyway.

program (input, output);

var
i,j:integer;

begin
writeln;
for i:= 1 to 5 do
write (i:5);
writeln;
for i:= 2 to 4 do
writeln (i:5);
writeln;
j:=i*i;
write (j:5);
writeln;
end.



Report •

#9
November 24, 2012 at 23:55:16
✔ Best Answer

your loops have no ends, ("end;"), the loops aren't nested, so you get nothing from statement "j=i*i", for your purposes i squared is not the object. You need loop (J) inside of bigger loop (i), and compute their extension (multiply j*i).

Report •

#10
November 25, 2012 at 08:19:25

Okay so this is what I got after following your advice. I got the right numbers, but I don't know how to put it in the table layout.

 program (input, output);

var
i, j : integer;

begin
  for i:= 1 to 5 do
     begin
      for j:= 1 to 4 do
       write(i*j:5);
      end;
end.


Report •

#11
November 25, 2012 at 10:11:52

program MulTab (input, output);

var
  i, j : integer;
begin
  for i:= 1 to 5 do begin
    writeln;
    for j:= 1 to 4 do
    write(i*j:5);
  end;
end.


Report •

#12
November 25, 2012 at 12:32:49

This is what I got after about a half hour. Thank you guys for your help.

program (input, output);

var
i, j : integer;

begin
for i:= 1 to 4 do
     begin
     for j:= 1 to 5 do
     write(i*j:10);
      writeln;
      end;
end.


Report •

#13
November 25, 2012 at 21:30:13

See? we knew you could do it... We had confidence in you when you did not. good job! ;-)

Report •

#14
May 3, 2013 at 19:54:06

{ email:tollyfather@gmail.com
multiplication program in pascal
}
program ass8;
var i,j,store:integer;
const tab=#9;
begin
for i:= 1 to 10 do
begin
for j:= 1 to 10 do
begin
store:= i*j;
write(store,tab);
end;
writeln();
end;
end.

Report •


Ask Question