Advertisement
informaticage

Untitled

Oct 18th, 2016
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1.  boolean b[] = new boolean[10];
  2.         int arr[] = arr1;
  3.         int darr[] = arr2;
  4.         int tk = 0;
  5.         int c = 0;
  6.         boolean flag = false;
  7.         while(!flag)
  8.             for(int i = 0; i < arr.length - 1; i++) {
  9.                 b[i] = false;
  10.                 if(arr[i] % darr[i] == 0)
  11.                 {
  12.                     b[i] = true;
  13.                     tk++;
  14.                 }
  15.                
  16.                 if(++c >= 5) flag = !flag;
  17.             }
  18.        
  19. arr1 = {3, 9, 8, 2, 1, -1, 7, 9, -4, 10};
  20. arr2 = {1, 9, 2, 2, 6,  3, 9, 1,  9, 5};
  21.  
  22. Trovare i valori di b[], c e tk.
  23.  
  24. Soluzioni:
  25. b[] =  true, true, true, true, false, false, false, true, false
  26. c = 9
  27. tk = 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement