Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. bool is_triangular(int n , int **tab) {
  5. bool check1=true;
  6. bool check=true;
  7. for(int i=0; i<n; i++)
  8. for(int j=i; j<n; j++){
  9. if(tab[i][j]!=0)check1=false;
  10. if(tab[j][i]!=0)check=false;
  11. }
  12. return check || check1;
  13. }
  14.  
  15. int main() {
  16. int tab[3][3] = {{0,0,0}, {1,0,0}, {1,1,0}};
  17. if(is_triangular(3, tab))
  18. printf("Trojkoatna");
  19. else
  20. printf("Nie jest trojkatna");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement