Write a program to input temperature in Celsius and convert it into Fahrenheit. If the temperature is more
than 98.6 F then display “Fever” otherwise “Normal”.
[ F=(9/5)*c+32]
Answers
Answered by
1
public class Pro{
public static void main ( String[] args ){
Scanner sc = new Scanner (System.in);
System.out.println("Enter 1 to input temparature in farenheit or 2 to enter in Celsius");
int ch = sc.nextInt( );
switch (ch){
case 1:
System.out.println("Enter temparature");
int temp = sc.nextint( );
if (temp > 98.6)
System.out.println("Fever");
else
System.out.println("Not Fever");
break;
case 2:
System.out.println("Enter temparature");
int temp = sc.nextint( );
temp = (9/5)*temp+32;
if (temp > 98.6 )
System.out.println("Fever");
else
System.out.println("Not Fever");
break;
}
}
}
Similar questions
English,
1 month ago
Math,
1 month ago
Math,
1 month ago
Math,
2 months ago
Social Sciences,
2 months ago
Computer Science,
9 months ago
Math,
9 months ago