Untitled
import java.util.Scanner;public class Degree {public static void main(String[] args) {Scanner take= new Scanner(System.in);System.out.print("Enter F for Farhnite or C for Celisues : ");String Choose = take.nextLine();if(Choose.equals( "F")){ System.out.print("input your Cel : "); float cel = take.nextInt(); System.out.print(Cel(cel)); }else if(Choose.equals("C")){System.out.print("input your Far"); float far = take.nextInt();System.out.print(Far(far)); }else{System.out.print("wrong input "); }take.close(); } static float Far(float cel){return (cel*5/9)+32 ;}static float Cel(float far){ return (far*9/5)-32 ;}}
Leave a Comment