Monday, July 9, 2007

Write a C program to multiply two matrices.

Are you sure you know this? A lot of people think they already know this, but guess what? So take a good look at this C program. Its asked in most of the interviews as a warm up question.


// Matrix A (m*n)
// Matrix B (n*k)
// Matrix C (m*k)

for(i=0; i < m; i++)
{
for(j=0;j < k;j++)
{
c[i][j]=0;
for(l=0;l < n;l++)
c[i][j] += a[i][l] * b[l][j];
}
}

5 comments:

Easy Tutor said...

Awesome collection of programs. Thanks for Posting.

I believe you should also check Syntax-Example.com it has huge collection of C, C++ Programs

Anonymous said...

Definitely believe that which you said. Your favorite
reason seemed to be on the net the simplest thing to be aware of.
I say to you, I definitely get irked while people consider worries that
they plainly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

Also visit my blog post - http://Su-Press.net/en/modules/profile/userinfo.php?uid=1139

Anonymous said...

Definіtely believе that ωhich you stаted.

Your fаνοrite justification appeаred to be on the internet the easiest thing to be aωare оf.
I say to you, I definitely get iгked
whilе peοple think about wоrгies that they
plаinly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people could take a signal. Will likely be back to get more. Thanks

Here is my web site: payday loans uk

Anonymous said...

I'm now not certain where you are getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thank you for excellent info I used to be in search of this information for my mission.

Also visit my homepage ... height to waist ratio

Anonymous said...

Asking questions are truly fastidiοus thing if you are not undeгstanding somethіng fully, but this paragraph pгovіdes fastidiouѕ understanding yet.


My blοg post :: payday loans