Advertisement
193030

input backup

Dec 1st, 2021
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main()
  6. {
  7. //int nx, ny, ng;
  8. int nx = 4;
  9. int ny = 5;
  10. int ng = 3;
  11. //scanf_s("%d %d %d", &nx, &ny, &ng);
  12. int arr[100][100];
  13. int i, j;
  14. for (i = 0; i < nx; i++) {
  15. for (j = 0; j <ny; j++) {
  16. scanf_s("%d", &arr[i][j]);
  17. }
  18. }
  19.  
  20. printf("Two Dimensional array elements:\n");
  21. for (i = 0; i < nx; i++) {
  22. for (j = 0; j <ny; j++) {
  23. printf("%d ", arr[i][j]);
  24. if (j == ny-1) { // nx?
  25. printf("\n");
  26. }
  27. }
  28. }
  29.  
  30. }
  31.  
Advertisement
RAW Paste Data Copied
Advertisement