Advertisement
daniv1

29.13

Oct 29th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #define size 4
  5. void setNull(double array[][size])
  6. {
  7.     for(int i = 0 ; i != 4 ; ++i)
  8.     {
  9.         array[i][i] = 0;
  10.     }
  11. }
  12.  
  13. void print2dArray(double array[][size])
  14. {
  15.     for(int i = 0; i!= size ; ++i)
  16.     {
  17.         for(int j = 0 ; j != size; ++j)
  18.         {
  19.             printf("%.2lf ",array[i][j]);
  20.         }
  21.         printf("\n");
  22.     }
  23. }
  24.  
  25. int main()
  26. {
  27.     double array[size][size]= {{2,4,-6,7.4},
  28.                          {4.5,-3,5,0},
  29.                          {9.7,4.2,-3.8,2.75},
  30.                          {3.3,-0.6,0,3.5}};
  31.  
  32.     setNull(array);
  33.     print2dArray(array);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement