Uploaded by cayabo1578

Зки

advertisement
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.Scanner;
import static java.lang.Math.*;
public class Main
{
public static void main(String[] args) {
System.out.println("Выражение ax2 + bx + c = 0");
Scanner in = new Scanner(System.in);
System.out.println("Введите a");
int a = in.nextInt();
System.out.println("Введите b");
int b = in.nextInt();
System.out.println("Введите c");
int c = in.nextInt(); int d = b*b - 4*a*c;
if(d < 0) System.out.println("Нет действительных корней");
if(d == 0) {
double o = -b / (2*a);
System.out.println("x = " + o);
}
if(d > 0){
double o = (-b + Math.sqrt(d)) / (2 * a);
double s = (-b - Math.sqrt(d)) / (2 * a);
System.out.println("x1 = " + o + ", x2 = " + s);
}
}
}
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Введите температуру");
int temp = in.nextInt();
System.out.println("Выберите тип перевода");
int ch = in.nextInt();
switch(ch){
case 1: // F/C
double F = (temp * 9/5) + 32;
System.out.println(F);
break;
case 2: // K/C
double K = temp + 273.15;
System.out.println(K);
break;
case 3: // C/F
double C = (temp - 32) * 5/9;
System.out.println(C);
break;
case 4: // K/F
double KK = (temp - 32) * 5/9 + 273.15;
System.out.println(KK);
break;
case 5: // C/K
double CC = temp - 273.15;
System.out.println(CC);
break;
case 6: // F/K
double FF = (temp - 273.15) * 9/5 + 32;
System.out.println(FF);
break;
}
}
}
Download