Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. package zad2;
  2.  
  3. public class Zad2 {
  4.  
  5. public static void main(String[] args) {
  6. Zad2 main = new Zad2();
  7. int liczba;
  8. int[][] tablica = new int[10][10];
  9. for (int i = 0; i < 10; i++)
  10. {
  11. for (int j = 0; j < 10; j++)
  12. {
  13. if (NWD(i,j)==1) tablica[i][j]=1;
  14. else tablica[i][j]=0;
  15. System.out.print(tablica[i][j]);
  16. }
  17. System.out.println();
  18. }
  19. }
  20.  
  21. public static int NWD(int x, int y) {
  22. while (x != y && x!=0 && y!=0) {
  23. if (x > y) x -= y;
  24. else y -= x;
  25. }
  26. return x;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement