Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2011
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.20 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main( )
  5. {
  6.     int linhas,colunas, i, j;
  7.     int ln, cn;
  8.    
  9.     ln = 0;
  10.     cn = 0;
  11.  
  12.     printf("Entre com o numero de linhas: ");
  13.     scanf("%d",&linhas);
  14.     printf("Entre com o numero de colunas: ");
  15.     scanf("%d",&colunas);
  16.  
  17.     int A[linhas][colunas];
  18.    
  19.         for (i=0; i<linhas; i++)
  20.           for(j=0; j<colunas; j++)
  21.           {
  22.           printf(" Entre com os elementos da matriz 1 [%d][%d]:",i+1,j+1);
  23.           scanf("%d",&A[i][j]);
  24.           }
  25.          
  26.              if (A[i] == 0)
  27.              ln = ln + 1;
  28.  
  29.              if (A[j] == 0)
  30.              cn = cn + 1;
  31.  
  32.                if (ln > 0 && cn >0)
  33.                printf("O número de linhas e colunas nulas eh [%d] e [%d]\n\n",ln,cn);
  34.                else
  35.                printf("A matriz nao apresenta linhas e colunas nulas\n\n");
  36.  
  37.      
  38.            printf("\n\nA matriz A criada eh: \n\n");
  39.              for (i=0; i<linhas; i++)
  40.              {
  41.                 for(j=0; j<colunas;j++)
  42.                 printf("%3.d\t",A[i][j]);
  43.                 printf("\n\n");
  44.              }
  45.  
  46.                printf("\n\n\n");
  47.               getch();
  48.               return 0;
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement