I have a problem that i need to solve, and dont know how to do it.
I have two arrays of 80 numbers (array[1..80] of integer) and i want to multiply them, saving the result in another array. I am beginner in pascal, learning it at school, so i have only this and I dont know what to do next. I am from Czech republic, so i have variables in czech. I need it tomorrow, so please reply as soon as possible. Thank for any answer.

var j,l :integer
pole1, pole2, naspole1, naspole2 : array[1..80] of integer;

...
for l:=80 downto 1 do begin
       for j:=2 to 80  do
        begin
          if nas2<>0 then naspole1[j]:=pole1[j]*pole2[j]+nas2
          else  naspole1[j]:=pole1[j]*pole2[l];
          nas2:=0;
          if naspole1[j]>=10 then
            begin
            nas1:=naspole1[j] div 10;
            nas2:=naspole1[j] mod 10;
            naspole1[j]:=nas1;
            end;
        write(naspole1[j]);
        end;
        end;
end;
...

Edited 5 Years Ago by globusak: n/a

nas := 0; 
for i:=1 to 80 do 
 begin
   naspole1[i]:=pole1[i]*pole2[i]+nas;
   if naspole1[i] >= 10 then
     begin
       naspole1[i] := naspole1[i] div 10;
       nas := naspole1[i] mod 10;
     end;
   write(naspole1[i]);
 end;

thanks for the reply, but i now have another problem, i need to get from sum of the 2 arrays into one array for example for 789*789.

In your case this is not visible. I do not understand what exactly you need. Write more, or give a full job.

Begin
      m:=80;
      for i:=80 downto 1 do begin

        for j:=80 downto 1 do begin
          begin
          naspole1[j]:=(pole1[j]*pole2[80])+nas2 ;
          nas2:=0;
          if naspole1[j]>9 then
            begin
            nas1:=naspole1[j] mod 10;
            nas2:=naspole1[j] div 10;
            naspole1[j]:=nas1;
            end;
          naspole2[j]:=naspole1[j]
          end;
         end;
         for l:=80 downto 1 do begin
         sci1:=vysledekpole[l];
         if vetsi=1 then sci2:=sci2+1;
         vysledekpole[l]:=sci1+naspole2[l];
         vetsi:=0;
         if vysledekpole[l]>=10 then
         begin
         vysledekpole[l]:=vysledekpole[l] mod 10;
         vetsi:=1;
         end;
         end;
        end;
       for k:=1 to 80 do begin
      write(naspole2[k]); end;
     End;

Write a task that is necessary. The code is not completely understood.
As I understand it there are 2 of the array. Need to multiply their elements and get summ? If yes, then this:

sum := 0;
  for i:=1 to 80 do
   begin
     naspole1[i]:=pole1[i]*pole2[i];
     sum := sum + naspole1[i];
     writeln(naspole1[i]);
   end;
   writeln(sum);
This question has already been answered. Start a new discussion instead.