Computer Science, asked by aashihunjan5, 5 months ago

write a program In java to input temperature of the day. if the temperature is less than 20°c consider it a cold day, if temperature is more than 40°c consider it a hot day and if the temperature is between 20°c and 40°c consider it a normal day​

Answers

Answered by anindyaadhikari13
2

Question:-

  • Write a program In java to input temperature of the day. If the temperature is less than 20°c consider it a cold day, if temperature is more than 40°c consider it a hot day and if the temperature is between 20°c and 40°c consider it a normal day.

Program:-

import java.util.*;

class Temperature

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter temperature in Celsius: ");

double c=sc.nextDouble();

if(c<20)

System.out.println("Its a cold day.");

else if(c<=40)

System.out.println("Its a Normal Day.");

else

System.out.println("Its a hot day. ");

}

}

Similar questions