Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- bool is_triangular(int n , int **tab) {
- bool check1=true;
- bool check=true;
- for(int i=0; i<n; i++)
- for(int j=i; j<n; j++){
- if(tab[i][j]!=0)check1=false;
- if(tab[j][i]!=0)check=false;
- }
- return check || check1;
- }
- int main() {
- int tab[3][3] = {{0,0,0}, {1,0,0}, {1,1,0}};
- if(is_triangular(3, tab))
- printf("Trojkoatna");
- else
- printf("Nie jest trojkatna");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement