Advertisement
Marcos_Carvalho

scilab

Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. clear;
  2. clc;
  3. N= input ("digite um numero: ");
  4. matriz=[ N;N];
  5. vetor=[6];
  6. flag=0;
  7. for i=1:1:N;
  8. for j=1:1:N;
  9. matriz(i,j) = input("digite ");
  10.  
  11. end
  12. end
  13.  
  14. for i=1:1:N;
  15. for j=1:1:N;
  16. mprintf(" %d",matriz(i,j));
  17. end
  18. mprintf("\n");
  19. end
  20.  
  21. for i=1: 1: N;
  22. if matriz(i,i) <> 1 then
  23. vetor(1)= 0;
  24. flag=1;
  25. end
  26. end
  27. if flag==0 then
  28. vetor(1)=1;
  29. end
  30.  
  31. flag=1;
  32.  
  33. for i=1: 1: N;
  34. for j=1: 1: N;
  35. if i <> j then
  36. if matriz(i,j) <> matriz(j,i) then
  37. flag=0;
  38. vetor(2)=0;
  39. end
  40. end
  41. end
  42. end
  43.  
  44. if flag==1 then
  45. vetor(2)=1;
  46. end
  47.  
  48. flag=1;
  49.  
  50. for i=1: 1: N
  51. for j=1, k=0: 1: N
  52. if matriz(i,j) == 1 then
  53. k=k+1;
  54. end
  55. if k > 1 then
  56. vetor(3)=0;
  57. flag=0;
  58. end
  59. end
  60. end
  61.  
  62. if flag==1 then
  63. vetor(3)=1;
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement