danb1212

Untitled

Feb 16th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7. int m, n, i, j;
  8. printf("Enter m, n: ");
  9. scanf("%d %d", &m, &n);
  10.  
  11. int a[2][3]= {{1, 0, m},
  12. {0, 1, n}};
  13. do
  14. {
  15. if ( a[0][2] < a[1][2] )
  16. {
  17. a[0][0] = a[1][0]; a[0][1] = a[1][1]; a[0][2] = a[1][2];
  18. a[1][0] = a[0][0]; a[1][1] = a[0][1]; a[1][2] = a[0][2];
  19. }
  20. else
  21. {
  22. a[0][0]= (a[0][0] - a[1][0]); a[0][1]= (a[0][1] - a[1][1]);a[0][2]= (a[0][2] - a[1][2]);
  23. }
  24. } while( (a[0][2] - a[1][2]) != 0);
  25.  
  26. for ( i = 0; i <= 1; i++ )
  27. {
  28. for ( j = 0; j <= 2; j++ )
  29. {
  30. printf("a[%d][%d] = %d\t", i,j, a[i][j] );
  31. }
  32. printf("\n");
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment