Advertisement
ricardorichsn

Sem2Nac1exer3

Aug 30th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include<stdlib.h>
  2. #include<stdio.h>
  3. #include<string.h>
  4. #define o 3
  5.  
  6. int main()
  7. {
  8.     int l, c, m[o][o], coluna;
  9.     float ma=0.0;
  10.  
  11.     srand(time(0));
  12.     for(l=0; l<o ; l++)
  13.     {
  14.         for(c=0; c<o ; c++)
  15.         {
  16.             m[l][c]=rand()%10;
  17.             printf("%d\t", m[l][c]);
  18.         }
  19.         printf("\n");
  20.     }
  21.  
  22.     printf("\n\nDigite um numero valido de uma coluna: ");
  23.     scanf("%d", &coluna);
  24.  
  25.     for(l=0; l<o ; l++)
  26.         ma += m[l][coluna];
  27.     ma/=o;
  28.     printf("\n\nMedia aritmetica da coluna: %f", ma);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement