Var b,a:integer; begin for b:=1 to 10 do begin for a:=1 to 10 do begin writeln(a,'*',b,'=',a*b); end; end; end. получается не в виде таблицы а в столбик
// F# [<EntryPoint>] let main argv = let generateTable n m = Array2D.init n m (fun i j -> (i+1) * (j+1)) let printMatrix (matrix:int[,]) = printf " " for i = 0 to (Array2D.length1 matrix) - 1 do printf "%4d " (i+1) printf "\n" printf " " for i = 0 to (Array2D.length1 matrix) - 1 do printf "" printf "\n" for j = 0 to (Array2D.length2 matrix) - 1 do printf "%2d |" (j+1) for i = 0 to (Array2D.length1 matrix) - 1 do printf "%4d " matrix.[i, j] printf "\n" printf "\n" let inputArray = generateTable 10 10 printMatrix inputArray System.Console.ReadKey true |> ignore 0
begin
for b:=1 to 10 do begin
for a:=1 to 10 do begin
writeln(a,'*',b,'=',a*b);
end;
end;
end.
получается не в виде таблицы
а в столбик
[<EntryPoint>]
let main argv =
let generateTable n m =
Array2D.init n m (fun i j -> (i+1) * (j+1))
let printMatrix (matrix:int[,]) =
printf " "
for i = 0 to (Array2D.length1 matrix) - 1 do
printf "%4d " (i+1)
printf "\n"
printf " "
for i = 0 to (Array2D.length1 matrix) - 1 do
printf ""
printf "\n"
for j = 0 to (Array2D.length2 matrix) - 1 do
printf "%2d |" (j+1)
for i = 0 to (Array2D.length1 matrix) - 1 do
printf "%4d " matrix.[i, j]
printf "\n"
printf "\n"
let inputArray = generateTable 10 10
printMatrix inputArray
System.Console.ReadKey true |> ignore
0