Advertisement
argentinapb

Untitled

Mar 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. void matriz();
  3.  
  4. int main(){
  5. matriz();
  6. return 0;
  7. }
  8. void matriz(){
  9. int i = 0, j = 0, coluna = 0, mat[100][100], x = 1;
  10. while (x != -2){
  11. while(x != -2){
  12. scanf("%d", &x);
  13. if(x > 0){
  14. mat[i][j] = x;
  15. j++;
  16. coluna++;
  17. }
  18.  
  19. else if(x < 0){
  20. j = 0;
  21. i++;
  22. break;
  23. }
  24.  
  25. }
  26. if(x == -2){
  27. break;
  28. }
  29. }
  30. printf("numero de colunas: %d\n", coluna);
  31. printf("numero de linhas: %d", i);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement