Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EqualsSumLeftRight {
- public static void main(String[] agrs) {
- Scanner scanner = new Scanner(System.in);
- int num1 = Integer.parseInt(scanner.nextLine());
- int num2 = Integer.parseInt(scanner.nextLine());
- for (int i = num1; i <= num2; i++) {
- int first = i / 10000;
- int second = (i / 1000) % 10;
- int third = (i / 100) % 10;
- int forth = (i / 10) % 10;
- int fifth = i % 10;
- if (first + second == forth + fifth) {
- System.out.print(i + " ");
- }else if (first + second < forth + fifth){
- if(first + second + third == forth + fifth){
- System.out.print(i + " ");
- }
- }else if(first + second > forth + fifth){
- if(first + second == forth + fifth + third){
- System.out.print(i + " ");
- }
- }
- }
- }
- }
- // противоречиви условия
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement