SHARE
TWEET

Untitled

a guest Oct 17th, 2019 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(){
  4. int a = 4;
  5. int c[16]= {1, 2, 3, 4, 7, 1, 2, 3, 8, 7, 1 , 2, 9, 8, 7, 1};
  6. is_same_diagonals (a, c[16]);
  7. }
  8.  
  9.  
  10. int is_same_diagonals (int n, int a[]){
  11. int condition = 0;
  12. int j = 0;
  13. for (int firsthalf = 0; firsthalf < n-1; firsthalf++)
  14. {
  15.   for ()
  16.   while (j < n*n )
  17.   {
  18.       if (a[firsthalf] == a[j])
  19.       {
  20.           condition == 1;
  21.           j = j + (n+1);
  22.       }
  23.       else
  24.       {
  25.           condition == 0;
  26.       }
  27.     j++;
  28.   }
  29.  
  30. }
  31. if (condition == 1)
  32. {
  33. int sechalf;    
  34. for (int sechalf = n; sechalf < n*n; sechalf += n);
  35. {
  36.   for (int x = n; x < n*n; x += (n+1))
  37.   {
  38.       if ( a[sechalf] == a[x])
  39.       {
  40.           condition == 1;
  41.       }
  42.      else
  43.       {
  44.             condition == 0;
  45.        }
  46.   }
  47. }
  48. }
  49.  
  50. if (condition == 1)
  51. {
  52.     printf("The matrix qualifies as having diagonals with the same values.");
  53. }
  54. else
  55. {
  56.     printf("The matrix doesn't qualify as having diagonals with the same value.");  
  57. }
  58. return (condition);
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top