Created
December 13, 2016 09:09
-
-
Save i0nyx/c23440e41fafbd339078656e2a2a99f6 to your computer and use it in GitHub Desktop.
Glava 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Даны действительные числа х и у, не равные друг другу. Меньшее из | |
этих двух чисел заменить половиной их суммы, а большее – их удвоенным | |
произведением. | |
*/ | |
package gl_1.zadanie_gl_1; | |
import java.util.Scanner; | |
public class N_3 { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Введите число Х и У не равные друг другу:"); | |
int x=0,y=0; | |
if(sc.hasNextInt()){ | |
x = sc.nextInt(); | |
y = sc.nextInt(); | |
if(x == y){ | |
System.out.println("Вы ввели равные числа!"); | |
}else{ | |
if(x < y){ | |
int ax = (x+y)/2; | |
int by = (x*y)*2; | |
System.out.println("x = " + ax + ";\ny = " + by); | |
}else{ | |
int ax = (x*y)*2; | |
int by = (x+y)/2; | |
System.out.println("x = " + ax + ";\ny = " + by); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment