MASchmidt

potenzmenge

Feb 3rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1.  
  2. public class potenzmenge {
  3.  
  4.     public static void main(String[] args) {
  5.         int x, y, z, treffer = 0;
  6.         int max = 8;
  7.         max++;
  8.        
  9.         for(int i=0; i<max; i++) {
  10.             x = i;
  11.             for(int j=0; j<max; j++) {
  12.                 y = j;
  13.                 for(int k=0; k<max; k++) {
  14.                     z = k;
  15.                     if((x+y+z)%3==0) {
  16.                         treffer++;
  17.                     }
  18.                 }
  19.                
  20.             }
  21.         }
  22.         System.out.print(treffer);
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment