oaip
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args){
|
||||
Scanner in = new Scanner(System.in);
|
||||
int a,b;
|
||||
double x = 0;
|
||||
System.out.print("Введите a= ");
|
||||
a = in.nextInt();
|
||||
System.out.print("Введите b= ");
|
||||
b = in.nextInt();
|
||||
if (a > b){
|
||||
x = (double)(a*b - 5) / a;
|
||||
} else if (a < b){
|
||||
if (b != 0) {
|
||||
x = (double)a / b + 1;
|
||||
} else {
|
||||
System.out.println("Ошибка: деление на ноль!");
|
||||
}
|
||||
} else {
|
||||
x = -1;
|
||||
}
|
||||
System.out.printf("При a=%d b=%d x=%.2f%n", a, b, x);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user