Write a program in java to enter the temperature and print the following message
according to input temperature?
temp<=0 "very cold"
0<temp<=10 “cold”
10<temp<=20 “Cool out “
20<temp<=30 “Warm”
temp>30 “Hot
import java.util.*;
class temperature
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int t;
System.out.println("Enter the temperature");
t=sc.nextInt();
if(t<=0)
System.out.println("Very Cold");
if(0<t && t<=10)
System.out.println("Cold");
if(10<t && t<=20)
System.out.println("Cool Out");
if(20<t && t<=30)
System.out.println("Warm");
if(t>30)
System.out.println("HOT");
}
}
according to input temperature?
temp<=0 "very cold"
0<temp<=10 “cold”
10<temp<=20 “Cool out “
20<temp<=30 “Warm”
temp>30 “Hot
import java.util.*;
class temperature
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int t;
System.out.println("Enter the temperature");
t=sc.nextInt();
if(t<=0)
System.out.println("Very Cold");
if(0<t && t<=10)
System.out.println("Cold");
if(10<t && t<=20)
System.out.println("Cool Out");
if(20<t && t<=30)
System.out.println("Warm");
if(t>30)
System.out.println("HOT");
}
}