Celsius to fahrenheit
previous NextExample
import java.util.Scanner;
class Celsius
{
public static void main(String[] args) {
float c;
float d;
Scanner sc = new Scanner(System.in);
System.out.println("Enter temp in centigrade: ");
c = sc.nextFloat();
d = (float)((1.8*c) + 32.0);
System.out.print("Temperature in Fahrenheit ="+d);
}
}
Output :
Enter temp in centigrade 100 Temperature in Fahrenheit =212.0