Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. program

program

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    singh niraj40 yahoo com
    wrote on last edited by
    #1

    /* Program for multiplication of two matrices */ # include <stdio.h> # include <conio.h> # define ROW 3 # define COL 3 void main() { int mat1[ROW][COL],mat2[ROW][COL],mat3[ROW][COL]; int i,j,k; clrscr(); printf("\n Enter matrix mat1(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) { scanf("%d",&mat1[i][j]); } printf("\n Matrix 1 is %d \n",mat1[i][j]); printf("\n Enter matrix mat2(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) scanf("%d",&mat2[i][j]); } printf("\n Matrix 2 is %d \n",mat2[i][j]); } //Multiplication for(i=0;i<ROW;i++) for(j=0;j<COL;j++) { mat3[i][j]=0; for(k=0;k<COL;k++) mat3[i][j]+=mat3[i][j]+mat1[i][k] * mat2[k][j]; } // End of multiplication printf("\n The Resultant matrix mat3 is: \n"); for(i=0;i<ROW;i++) for(j=0;j<COL;j++) printf("\n %d",mat3[i][j]); printf("\n"); getch(); } main yeh program ka code run kara raha hoo par ismein kuch logical error hai jo main remove nahi kar paa raha hoo.plzzzzzzzz help me..

    M K M 3 Replies Last reply
    0
    • S singh niraj40 yahoo com

      /* Program for multiplication of two matrices */ # include <stdio.h> # include <conio.h> # define ROW 3 # define COL 3 void main() { int mat1[ROW][COL],mat2[ROW][COL],mat3[ROW][COL]; int i,j,k; clrscr(); printf("\n Enter matrix mat1(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) { scanf("%d",&mat1[i][j]); } printf("\n Matrix 1 is %d \n",mat1[i][j]); printf("\n Enter matrix mat2(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) scanf("%d",&mat2[i][j]); } printf("\n Matrix 2 is %d \n",mat2[i][j]); } //Multiplication for(i=0;i<ROW;i++) for(j=0;j<COL;j++) { mat3[i][j]=0; for(k=0;k<COL;k++) mat3[i][j]+=mat3[i][j]+mat1[i][k] * mat2[k][j]; } // End of multiplication printf("\n The Resultant matrix mat3 is: \n"); for(i=0;i<ROW;i++) for(j=0;j<COL;j++) printf("\n %d",mat3[i][j]); printf("\n"); getch(); } main yeh program ka code run kara raha hoo par ismein kuch logical error hai jo main remove nahi kar paa raha hoo.plzzzzzzzz help me..

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      ok, what's the question ? you have compilation errors ? logic errors ? did you run this with the debugger ? did you try using a pen and paper to simulate your algorithm ?

      This signature was proudly tested on animals.

      1 Reply Last reply
      0
      • S singh niraj40 yahoo com

        /* Program for multiplication of two matrices */ # include <stdio.h> # include <conio.h> # define ROW 3 # define COL 3 void main() { int mat1[ROW][COL],mat2[ROW][COL],mat3[ROW][COL]; int i,j,k; clrscr(); printf("\n Enter matrix mat1(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) { scanf("%d",&mat1[i][j]); } printf("\n Matrix 1 is %d \n",mat1[i][j]); printf("\n Enter matrix mat2(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) scanf("%d",&mat2[i][j]); } printf("\n Matrix 2 is %d \n",mat2[i][j]); } //Multiplication for(i=0;i<ROW;i++) for(j=0;j<COL;j++) { mat3[i][j]=0; for(k=0;k<COL;k++) mat3[i][j]+=mat3[i][j]+mat1[i][k] * mat2[k][j]; } // End of multiplication printf("\n The Resultant matrix mat3 is: \n"); for(i=0;i<ROW;i++) for(j=0;j<COL;j++) printf("\n %d",mat3[i][j]); printf("\n"); getch(); } main yeh program ka code run kara raha hoo par ismein kuch logical error hai jo main remove nahi kar paa raha hoo.plzzzzzzzz help me..

        K Offline
        K Offline
        Krischu
        wrote on last edited by
        #3

        I think you gotta check your for loop bracing. Please put your question in English. Also a bit prettier printing would help yourself in understanding your code. You might want to put it in a code block after running it through "indent". -- Christoph

        1 Reply Last reply
        0
        • S singh niraj40 yahoo com

          /* Program for multiplication of two matrices */ # include <stdio.h> # include <conio.h> # define ROW 3 # define COL 3 void main() { int mat1[ROW][COL],mat2[ROW][COL],mat3[ROW][COL]; int i,j,k; clrscr(); printf("\n Enter matrix mat1(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) { scanf("%d",&mat1[i][j]); } printf("\n Matrix 1 is %d \n",mat1[i][j]); printf("\n Enter matrix mat2(%dx%d)row-wise:\n ",ROW,COL); for(i=0;i<ROW;i++) { for(j=0;j<COL;j++) scanf("%d",&mat2[i][j]); } printf("\n Matrix 2 is %d \n",mat2[i][j]); } //Multiplication for(i=0;i<ROW;i++) for(j=0;j<COL;j++) { mat3[i][j]=0; for(k=0;k<COL;k++) mat3[i][j]+=mat3[i][j]+mat1[i][k] * mat2[k][j]; } // End of multiplication printf("\n The Resultant matrix mat3 is: \n"); for(i=0;i<ROW;i++) for(j=0;j<COL;j++) printf("\n %d",mat3[i][j]); printf("\n"); getch(); } main yeh program ka code run kara raha hoo par ismein kuch logical error hai jo main remove nahi kar paa raha hoo.plzzzzzzzz help me..

          M Offline
          M Offline
          MindCoder79
          wrote on last edited by
          #4

          http://www.codeproject.com/Messages/3265626/Re-c-Program.aspx[^]:cool:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups