10 comments:

  1. import java.util.Scanner;

    class Test{

    public static void main(String ar[])
    {

    float a,con;
    int o;
    Scanner sc=new Scanner(System.in);
    System.out.println("Enter Temperature");
    a=sc.nextFloat();
    System.out.println("Select Option");
    System.out.println("1.Convert from Celsius to Fahrenheit");
    System.out.println("2.Convert from Fahrenheit to Celsius");
    o=sc.nextInt();
    if(o==1)
    {
    a*=1.8;
    a+=32;
    System.out.println(a+"F");
    }
    else if(o==2)
    {
    a-=32;
    a/=1.8;

    System.out.println(a+"C");
    }
    else
    {
    System.out.println("Wrong Input");
    }




    }
    }

    ReplyDelete
  2. //program to convert fahrenheit to celsius.
    import java.util.Scanner;
    class Convert
    {
    public static void main(String Args[])
    {
    float F;
    double C;
    System.out.println("enter the value of fahrenheit");
    Scanner scan=new Scanner(System.in);
    F=scan.nextFloat();
    F=F-32;
    C=F/1.8;
    System.out.println("celsius ="+C);
    }
    }

    ReplyDelete
  3. import java.util.Scanner;
    class Celsius
    {
    public static void main(String ar[])
    {
    double Far,Total;
    Scanner sc=new Scanner(System.in);
    Far=sc.nextDouble();
    Total=(Far-32)/1.8;
    System.out.println("Fahrenhiet to Celcius"+Total);

    }
    }

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. import java.util.Scanner;


    class Temp
    {
    public static void main(String ar[])
    {
    double c,f;
    int ch;
    System.out.println("Choose your option\n 1 for celcius to fahrenheit \n 2 for fahrenheit to celcius");
    Scanner o=new Scanner(System.in);
    ch=o.nextInt();
    if(ch==1)
    {
    System.out.println("Enter temperature in celcius: ");
    c=o.nextDouble();
    f=1.8*c+32;
    System.out.println("Temperature in fahrenheit is: "+f);
    }
    else if(ch==2)
    {
    System.out.println("Enter temperature in fahrenheit: ");
    f=o.nextDouble();
    c=(f-32)/1.8;
    System.out.println("Temperaturein celciusis: "+c);
    }
    else
    System.out.println("Wrong choice");
    }
    }

    ReplyDelete
  6. import java.util.Scanner;

    class tempconv
    {
    public static void main(String ar[])
    {
    Scanner nd = new Scanner(System.in);
    float celsius,fahrenheit;
    System.out.println("Choose your option \n 1 for celcius to fahrenheit \n 2 for fahrenheit to celcius");
    System.out.println("enter your choice");

    int ch = nd.nextInt();
    if(ch==1)
    {
    System.out.println("enter the temperature in celsius");
    celsius = nd.nextFloat();
    fahrenheit = ((celsius * 9/5)+32);
    System.out.println(" the temperature converted from celsius to fahrenheit is : " +fahrenheit);

    }
    else
    if(ch==2)
    {
    System.out.println("enter the temperature in fahrenheit");
    fahrenheit = nd.nextFloat();
    celsius = (( fahrenheit - 32 ) * 5/9 );
    System.out.println(" the temperature converted from fahrenheit to celsius is : " +celsius);
    }
    else
    System.out.println("wrong choice entered");
    }

    }

    ReplyDelete
  7. import java.util.Scanner;
    public class Fahrenheit
    {
    public static void main(String args[])
    {
    float c,f;
    System.out.println("enter number");
    Scanner bsc=new Scanner(System.in);
    f=sc.nextFloat();
    c=(f-32)*5/9;
    System.out.println(c);
    }

    }

    ReplyDelete
  8. import java.util.Scanner;
    class Temp{
    public static void main(String ar[]){
    Scanner obj=new Scanner(System.in);
    int ft;
    double celcius;
    System.out.println("enter the value of temp in fareinheit");
    ft=obj.nextInt();
    celcius=(ft-32)/1.8;
    System.out.println("the respective temp in celcius is "+celcius);
    }
    }

    ReplyDelete
  9. class Celcius{
    public static void main(String ar[]){
    Double c;
    Double f=Double.parseDouble(ar[0]);
    c=((f-32)*5/9);
    System.out.printf("Temprature in celcius="+c);
    }
    }

    ReplyDelete
  10. package com.example.myapplication;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;

    public class FahreniteToCelsius extends Activity {

    int fahrenite,celsius;
    Button btFtoC;
    EditText etFtoC;
    TextView tvFtoC;

    @Override
    protected void onCreate( Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fahrenite_to_celsius);

    btFtoC=findViewById(R.id.btFtoC);
    etFtoC=findViewById(R.id.etFtoC);
    tvFtoC=findViewById(R.id.tvFtoC);

    btFtoC.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    fahrenite=Integer.parseInt(etFtoC.getText().toString());

    celsius=(fahrenite-32)*5/9;

    tvFtoC.setText("Celsius="+celsius);
    }
    });

    }
    }

    ReplyDelete