tag:blogger.com,1999:blog-6010073210891297879.post3244099971597622022..comments2023-09-03T03:30:40.979-07:00Comments on C and C++ Programs: Matrix MultiplicationLionelhttp://www.blogger.com/profile/11329883633967646018noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-6010073210891297879.post-32568777904348434882012-09-21T11:39:58.427-07:002012-09-21T11:39:58.427-07:00great job....great job....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-69835134126137736502012-09-21T08:01:50.629-07:002012-09-21T08:01:50.629-07:00Good and easyGood and easyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-85399436608547811442012-06-23T10:29:17.446-07:002012-06-23T10:29:17.446-07:00Thank you!!! was usefuleThank you!!! was usefuleAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-84635145052326917212012-02-20T10:18:44.341-08:002012-02-20T10:18:44.341-08:00hi,there is a mistake in your code ...
cout<<...hi,there is a mistake in your code ...<br />cout<<"The resultant matrix is ";<br />for( i = 0 ; i < 3 ; i++)<br />{<br />for( j = 0 ; j < 3 ; j++)<br /> here --> ////cout< ////cout<<c[i][j]<<" "; /////Annnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-38791495738102409752012-02-20T10:08:59.522-08:002012-02-20T10:08:59.522-08:00hi
there is a mistake in your code ...
cout<&l...hi<br />there is a mistake in your code ...<br /><br />cout<<"The resultant matrix is ";<br />for( i = 0 ; i < 3 ; i++)<br />{<br />for( j = 0 ; j < 3 ; j++)<br /> here --> ////cout< ////cout<<c[i][j]<<" "; /////Annnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-20620045517100925082011-08-24T09:13:11.533-07:002011-08-24T09:13:11.533-07:00Here im presenting a sample code to multiply two m...Here im presenting a sample code to multiply two matrix a , b and the result will be stored in matrix C<br /><br />#include<br />void main()<br />{<br /> int a[3][3] , b[3][3] , c[3][3];<br /><br /> int i , j , k;<br /> cout<<"Enter Matrix A";<br /> for( i = 0 ; i < 3 ; i++)<br /> for( j = 0 ; j < 3 ; j++)<br /> cin>>a[i][j];<br /> cout<<"Enter Matrix B";<br /> for( i = 0 ; i < 3 ; i++)<br /> for( j = 0 ; j < 3 ; j++)<br /> cin>>b[i][j];<br /> for( i = 0 ; i < 3 ; i++)<br /> for( j = 0 ; j < 3 ; j++)<br /> {<br /> c[i][j] = 0;<br /> for( k = 0 ;k < 3 ; k++)<br /> c[i][j] += a[i][k]*b[k][j];<br /> }<br /> cout<<"The resultant matrix is ";<br /> for( i = 0 ; i < 3 ; i++)<br /> {<br /> for( j = 0 ; j < 3 ; j++)<br /> cout<<a[i][j]<<" ";<br /> cout<<endl;<br /> }<br />}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-22583638222752263012011-05-12T10:16:47.542-07:002011-05-12T10:16:47.542-07:00why have you used a third variable "k" i...why have you used a third variable "k" in the multiplication matrix?? why not use "j"??<br />kindly reply ASAPMUDIThttps://www.blogger.com/profile/09193137478122244267noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-86677168113294480472011-05-05T05:36:53.657-07:002011-05-05T05:36:53.657-07:00Thanks for this useful example.Thanks for this useful example.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-58100855680499557922011-05-05T05:35:54.163-07:002011-05-05T05:35:54.163-07:00thanks for the matrix example. It helped me a lot....thanks for the matrix example. It helped me a lot.Mohamednoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-3550924527242142502011-04-24T12:06:19.720-07:002011-04-24T12:06:19.720-07:00Thanxx.... I have just started coding in c++ and i...Thanxx.... I have just started coding in c++ and i got stuck in that... but you provided a better material... thanxxx alot...samhttps://www.blogger.com/profile/01486725304138840243noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-22366509481001318992010-11-26T05:46:55.954-08:002010-11-26T05:46:55.954-08:00printf("\nEnter The Rows And Cloumns And Of T...printf("\nEnter The Rows And Cloumns And Of The Second Matrix:");<br />scanf("%d %d",&p,&q);<br /> this is wrong code for entering the values in array. here must be a loop needed.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-70558463372201969572010-11-26T05:46:24.699-08:002010-11-26T05:46:24.699-08:00printf("\nEnter The Rows And Cloumns And Of T...printf("\nEnter The Rows And Cloumns And Of The Second Matrix:");<br />scanf("%d %d",&p,&q);<br /> this is wrong code for entering the values in array. here must be a loop needed.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-29824272496578793442010-09-06T22:50:41.485-07:002010-09-06T22:50:41.485-07:00hi Lionel Noronha nice code request would u like t...hi Lionel Noronha nice code request would u like to be my friend over the net my email id is manish4mirth@gmail.com, i would like to exchange views over c language if u r intrested than mail me or we can use orkut alsomanishhttps://www.blogger.com/profile/09483879273911490933noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-8082971776526730562010-09-04T11:31:37.261-07:002010-09-04T11:31:37.261-07:00Hmm thanks! acutally i got struck in the main loop...Hmm thanks! acutally i got struck in the main loop in taking the limits, u done write!<br />Thanks again!Vibhuteshhttps://www.blogger.com/profile/12388954476180079401noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-28731356313358185462010-04-26T08:05:29.139-07:002010-04-26T08:05:29.139-07:00the program was little bigthe program was little bigUnknownhttps://www.blogger.com/profile/01538716880312109692noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-26571582777919149492010-01-21T11:46:57.031-08:002010-01-21T11:46:57.031-08:00there is an error in this programthere is an error in this programYogesh Shrivastavahttps://www.blogger.com/profile/12466500315430723254noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-80514588511893206302010-01-21T11:46:55.713-08:002010-01-21T11:46:55.713-08:00there is an error in this programthere is an error in this programYogesh Shrivastavahttps://www.blogger.com/profile/12466500315430723254noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-45240583038752243372008-06-18T03:38:00.000-07:002008-06-18T03:38:00.000-07:00could u care your explain yr Query.an example woul...could u care your explain yr Query.<BR/>an example would be sufficient.Lionelhttps://www.blogger.com/profile/11329883633967646018noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-12856916682302225872008-06-18T01:10:00.000-07:002008-06-18T01:10:00.000-07:00sir can we show row by coloumn multiplicatn as a o...sir can we show row by coloumn multiplicatn as a <BR/><BR/>out put if yes send me a code of this programabhishek srivastavahttps://www.blogger.com/profile/16419741463169648651noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-26121679263312550202008-05-10T02:34:00.000-07:002008-05-10T02:34:00.000-07:00cause of the previous changes the program code was...cause of the previous changes the program code was false <BR/>now the code is corrected thanx 4 yr supportLionelhttps://www.blogger.com/profile/11329883633967646018noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-43953428989420463512008-04-26T21:21:00.000-07:002008-04-26T21:21:00.000-07:00You are saying:printf("\nMultiplication Of The Abo...You are saying:<BR/>printf("\nMultiplication Of The Above Two Matrices Are:\n\n");<BR/>for(i=0;i< n;i++)<BR/>{<BR/>for(j=0;j< p;j++)<BR/>{<BR/>printf(" %d ",c[i][j]);<BR/>}<BR/>printf("\n");<BR/>}<BR/>However, the resulting matrix should be R[r1][c2], which based on your syntax are: m and q. Is that right?Davidhttps://www.blogger.com/profile/12977441354205992295noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-16872405832063765472008-03-04T19:56:00.000-08:002008-03-04T19:56:00.000-08:00Error Regreated !!!!!!!!!Have corrected it .....an...Error Regreated !!!!!!!!!<BR/><BR/>Have corrected it .....<BR/>any future hlp warmly welcomed!Lionelhttps://www.blogger.com/profile/11329883633967646018noreply@blogger.comtag:blogger.com,1999:blog-6010073210891297879.post-71534425458735806322008-03-04T16:13:00.000-08:002008-03-04T16:13:00.000-08:00i found some anomalies in your code:printf("\nEnte...i found some anomalies in your code:<BR/><BR/><I><BR/>printf("\nEnter The Rows And Cloumns And Of The Second Matrix:");<BR/>scanf("%d %d",&p,&q);<BR/></I><BR/>^ here, you put row and col into the variables p and q... but the next part...<BR/><BR/><I><BR/>printf("\nEnter Elements Of The Second Matrix:\n");<BR/>for(i=0;i< m;i++)<BR/>{<BR/>for(j=0;j< n;j++)<BR/>{<BR/>scanf("%d",&b[i][j]);<BR/>}<BR/>}<BR/></I><BR/>^ here, you used m and n as sentinels, instead of p and q...<BR/><BR/><I><BR/>printf("The Second Matrix Is:\n");<BR/>for(i=0;i< n;i++) // print the second matrix<BR/></I><BR/>^ same here...John Requirosohttps://www.blogger.com/profile/17454125303112783830noreply@blogger.com