Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<time.h>
- int main()
- {
- int i, j, a[100][100], row, col,flag=0;
- printf("enter a format of ( m x n ) row and col:\n ");
- scanf("%d%d", &row, &col);
- srand(time(null));
- for (i = 0; i < row; i++)
- {
- for (j = 0; j < col; j++)
- {
- a[i][j] = rand() % 10;
- }
- }
- for (i = 0; i < row; i++)
- {
- for (j = 0; j < col; j++)
- {
- a[i][j] = rand() % 10;
- }
- }
- for (i = 0; i < row; i++)
- {
- for (j = 0; j < col; j++)
- {
- if (row == col) //the attepts are not correct here.
- {
- if (i == 0 || j == 0)
- {
- flag = 1;
- }
- }
- }
- }
- if (flag == 1)
- {
- printf("%d\n is a square matrix.\n", a[i][j]);
- }
- else
- {
- printf("is not a square matrix.\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement