Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class main {
- static double Far_Cel(double t){
- double temp = 5/9.0;
- return (temp*(t-32));
- }
- static double Cel_Far(double t){
- double temp = 9/5.0;
- return (temp*t+32);
- }
- public static void main(String[] args){
- Scanner sc = new Scanner(System.in);
- String exit = "NO";
- while(!exit.equals("YES")){
- System.out.println("Что ты хочешь? \n1) Фарингейт в Цельсий \n2) Цельсий в Фарингейт ");
- int value = sc.nextInt();
- if(value == 1){ //Far_Cel
- System.out.println("Введи Фарингейты");
- double t = sc.nextDouble();
- System.out.println("C="+Far_Cel(t));
- }
- if(value == 2){
- System.out.println("Введи Цельсий");
- double t = sc.nextDouble();
- System.out.println("F="+Cel_Far(t));
- }
- System.out.println("Хочешь ли ты выйти? YES or NO");
- exit = sc.next();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement