Advertisement
porteno

Untitled

Nov 3rd, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1.  
  2. public class Q4_Main {
  3.  
  4. public static void main(String[] args) {
  5. int[][] numbers = {{39,72,3 ,8 ,0 ,2 ,54},
  6. {18,16,13,47,41,87,65},
  7. {34,78,37,99,97,46,56},
  8. {51,50,12,31,58,63,18},
  9. {23,4 ,11,26,83,25,65}};
  10. } //end of main
  11.  
  12. //answer q4.1
  13. public int place(int[][] nums, int x) {
  14. if(x<0 || x >= nums.length)
  15. return -1;
  16. int count = 0;
  17. for (int i = 0; i < x; i++) {
  18. count++;
  19. }
  20. return count;
  21. } //end of method
  22.  
  23. //answer q4.2
  24. public void printAndCount(int[][] nums, int small, int bigger) {
  25. for (int i = small; i <= bigger; i++) {
  26. System.out.println(nums[i]);
  27.  
  28. }
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement