Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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. for(int i=0;i<a;i++)
  19. for(int j=0;j<b;j++)
  20. {
  21. System.out.println("podaj liczbe");
  22. tab[i][j]=1.0/(i-5);
  23. }
  24. }
  25. catch(ArrayIndexOutOfBoundsException e)
  26. {
  27. System.out.println("przekroczono wymiar tablicy");
  28. }
  29.  
  30. catch(AritmeticException ex)
  31. {
  32. System.out.println("dzielenie przez 0");
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement