Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include "staticmatrix.h"
- void input(int(*input)[C])
- {
- int row, col;
- for (row = 0; row < R; row++)
- {
- for (col = 0; col < C; col++)
- {
- printf("\nEnter value for pos[%d,%d]\n", col, row);
- scanf_s("%d", &input[row][col]);
- }
- }
- }
- //void matrixProduct(int A[][C], int B[][C])
- //{
- // int row2 = 0, col2 = 0, psum = 0, product[R][C];
- // for (int row = 0; row < R; row++)
- // {
- // for (int col = 0; col < C; col++)
- // {
- // for (int control = row; control < R; control++)
- // psum += A[control][col2] + B[row2][control];
- //
- // }
- // }
- //
- //
- //
- // printf("\nThe product of matrix A and B is: \n");
- // display(product);
- //}
- void matrixSum(int A[][C], int B[][C])
- {
- int row, col, sum[R][C];
- for (row = 0; row < R; row++)
- {
- for (col = 0; col < C; col++)
- {
- sum[row][col] = A[row][col] + B[row][col];
- }
- }
- printf("\nThe sum of matrix A and B is: \n");
- display(sum);
- }
- void displayTranspose(int a[][C])
- {
- for (int row = 0; row<R; row++)
- {
- printf("\n");
- for (int column = 0; column<C; column++)
- {
- printf(" %d ", a[column][row]);
- }
- }
- }
- void display(int a[][C])
- {
- for(int row=0; row<R; row++)
- {
- printf ("\n");
- for(int column=0; column<C; column++)
- {
- printf (" %d ", a[row][column]);
- }
- }
- }
- float average(int a[][C])
- {
- float total=0;
- int count=0;
- for(int row=0; row<R; row++)
- {
- printf ("\n");
- for(int column=0; column<C; column++)
- {
- total+=a[row][column];
- count++;
- }
- }
- return total/count;
- }
- int findlowest(int a[][C])
- {
- int lowest=10;
- for(int row=0; row<R; row++)
- {
- for(int column=0; column<C; column++)
- {
- if (a[row][column]<lowest)
- lowest=a[row][column];
- }
- }
- return lowest;
- }
- int isSquare(int a[][C])
- {
- int rowcount=0, columncount=0;
- for(int row=0; row<R; row++)
- {
- rowcount++;
- }
- for(int column=0; column<C; column++)
- {
- columncount++;
- }
- if (rowcount==columncount)
- return 1;
- else
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement