Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zad3;
- import java.util.Scanner;
- public class Zad3
- {
- public static void main(String[] args) throws Exception
- {
- Scanner sc=new Scanner(System.in);
- System.out.println("podaj pierwszy wymiar tablicy");
- int a=sc.nextInt();
- System.out.println("podaj drugi wymiar tablicy");
- int b=sc.nextInt();
- double tab[][]=new double[a][b];
- try
- {
- for(int i=0;i<a;i++)
- for(int j=0;j<b;j++)
- {
- System.out.println("podaj liczbe");
- tab[i][j]=1.0/(i-5);
- }
- }
- catch(ArrayIndexOutOfBoundsException e)
- {
- System.out.println("przekroczono wymiar tablicy");
- }
- catch(AritmeticException ex)
- {
- System.out.println("dzielenie przez 0");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement