Multiplying two arrays
Don't put everything into one big main()

If you can separate out the reading of inputs and writing of results from the actual multiplications, then it will be easier to test the multiplication code separately.

Avoid non-standard libraries

Here we have "stdafx.h" and scanf_s that aren't part of standard C++.  Ditch those and use the standard facilities (e.g. std::cin &gt;&gt; a[j][l]).

Include what you use

We don't seem to use &lt;cmath&gt; anywhere, so let's drop that.  We'll need &lt;cstdio&gt; for std::printf() - or switch to C++ style output using &lt;iostream&gt;.

Avoid using the whole std namespace

The std namespace isn't one of the few that's designed to be imported wholesale like that, and there's potential for name conflicts when moving to a new standards version.  Specify just the names you need, or just get used to writing std:: - it's intentionally very short.

Use C++ collections

It's easier to work with the C++ collection types such as std::array or std::vector than with raw (C-style) arrays (which decay to pointers when passed as function arguments).