Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 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. for (int j = 0; j < 10; j++)
  11. {
  12. if (NWD(i,j)==1) tablica[i][j]=1;
  13. else tablica[i][j]=0;
  14. System.out.print(tablica[i][j]);
  15. }
  16. }
  17.  
  18. public static int NWD(int x, int y) {
  19. while (x != y && x!=0 && y!=0) {
  20. if (x > y) x -= y;
  21. else y -= x;
  22. }
  23. return x;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement