Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 7, 2020 14:47
Show Gist options
  • Save kryvoboker/ad6a616eb035a0b87492a79e30f1cc4e to your computer and use it in GitHub Desktop.
Save kryvoboker/ad6a616eb035a0b87492a79e30f1cc4e to your computer and use it in GitHub Desktop.
HomeWork3
import java.util.Scanner;
/**
*
* @author kamaz
*/
public class Main {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Input a");
int a = sc.nextInt();
int b = a/1000;
int c = a%1000/100;
int d = a%100/10;
int e = a%10/1;
if (((b + c) == (d + e)) || ((b + c) == ((d + e) / 2))) {
System.out.println("Ok");
}
else {
System.out.println("Bad");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment