Advertisement
Noibedya

Untitled

Jun 7th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. int main()
  5. {
  6.     int i, j, a[100][100], row, col,flag=0;
  7.     printf("enter a format of ( m x n ) row and col:\n ");
  8.     scanf("%d%d", &row, &col);
  9.     srand(time(null));
  10.     for (i = 0; i < row; i++)
  11.     {
  12.         for (j = 0; j < col; j++)
  13.         {
  14.             a[i][j] = rand() % 10;
  15.         }
  16.     }
  17.     for (i = 0; i < row; i++)
  18.     {
  19.         for (j = 0; j < col; j++)
  20.         {
  21.             a[i][j] = rand() % 10;
  22.         }
  23.     }
  24.     for (i = 0; i < row; i++)
  25.     {
  26.         for (j = 0; j < col; j++)
  27.         {
  28.             if (row == col)             //the attepts are not correct here.
  29.             {
  30.                 if (i == 0 || j == 0)
  31.                 {
  32.                     flag = 1;
  33.                 }
  34.             }
  35.         }
  36.     }
  37.     if (flag == 1)
  38.     {
  39.         printf("%d\n is a square matrix.\n", a[i][j]);
  40.     }
  41.     else
  42.     {
  43.         printf("is not a square matrix.\n");
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement