Tuesday 24 July 2012

Addition of matrix | 5*5 matrix addition

Addition of 5*5 matrix

void main()

{

int a[5][5],i,j,row[5];

clrscr();


//Read Matrix

printf("\n-----Enter 5X5 matrix below:-------\n");

for(i=0;i<5;i++)

{

for(j=0;j<5;j++)

{

scanf("%d",&a[i][j]);

}

}


//Display Matrix

printf("\n\n----- The matrix you entered is:-------\n");

for(i=0;i<5;i++)

{

for(j=0;j<5;j++)

{

printf("%d\t",a[i][j]);

}

printf("\n");

}


//Perform column-wise Addition

printf("\nPerforming Calculations.........\n");

for(j=0;j<5;j++)


{ row[j]=0;


for(i=0;i<5;i++)

{

row[j]=row[j]+a[i][j];

}

}


//Display Result of column-wise calculation

printf("------The result of column-wise addition is:----\n");

for(i=0;i<5;i++)

{

printf("Column %d ",i+1);

printf("\t %d\n",row[i]);

}

getch();

}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: