Advertisement
Guest User

Untitled

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