Advertisement
NLKappa

chto

Oct 12th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1.     import java.util.Scanner;
  2.  
  3.     public class Main {
  4.         public static boolean isSet (int a, int b, int c) {
  5.             if (a == b && b == c) {
  6.                 return true;
  7.             } else if (a != b && b != c && a != c) {
  8.                 return true;
  9.             } else {
  10.                 return false;
  11.             }
  12.         }
  13.  
  14.         public static void main(String[] args) {
  15.             Scanner sc = new Scanner(System.in);
  16.             System.out.println("Введите три числа от 1 до 3: ");
  17.             int A = sc.nextInt();
  18.             int B = sc.nextInt();
  19.             int C = sc.nextInt();
  20.  
  21.             if (isSet(A,B,C)) {
  22.                 System.out.println("Ваша комбинация является сетом.");
  23.             } else {
  24.                 System.out.println("Ваша комбинация не является сетом.");
  25.             }
  26.         }
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement