Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1.  
  2. package zad3;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Zad3
  7. {
  8. public static void main(String[] args) throws Exception
  9. {
  10. Scanner sc=new Scanner(System.in);
  11. System.out.println("podaj pierwszy wymiar tablicy");
  12. int a=sc.nextInt();
  13. System.out.println("podaj drugi wymiar tablicy");
  14. int b=sc.nextInt();
  15. double tab[][]=new double[a][b];
  16. try
  17. {
  18. try
  19. {
  20. for(int i=0;i<a;i++)
  21. for(int j=0;j<b;j++)
  22. {
  23. System.out.println("podaj liczbe");
  24. tab[i][j]=1.0/(i-5);
  25. }
  26. }
  27. catch(ArrayIndexOutOfBoundsException e)
  28. {
  29. System.out.println("przekroczono wymiar tablicy");
  30. }
  31. }
  32. catch(AritmeticException ex)
  33. {
  34. System.out.println("dzielenie przez 0");
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement