A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C# Sharp program to read temperature in centigrade and display a suitable message according to temperature state below
Q:

Write a C# Sharp program to read temperature in centigrade and display a suitable message according to temperature state below

0

Write a C# Sharp program to read temperature in centigrade and display a suitable message according to temperature state below :

Temp < 0 then Freezing weather
Temp 0-10 then Very Cold weather
Temp 10-20 then Cold weather
Temp 20-30 then Normal in Temp
Temp 30-40 then Its Hot
Temp >=40 then Its Very Hot

Sample Output:

Accept a temperature in centigrade and display a suitable message:                                            
--------------------------------------------------------------------
Input days temperature : 35                                                                                   
Its Hot.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise13  
{  
    public static void Main()
{
     int tmp;
    Console.Write("\n\n");
    Console.Write("Accept a temperature in centigrade and display a suitable message:\n");
    Console.Write("--------------------------------------------------------------------");
    Console.Write("\n\n");

    Console.Write("Input days temperature : ");
    tmp= Convert.ToInt32(Console.ReadLine());
   if(tmp<0)
             Console.Write("Freezing weather.\n");
   else if(tmp<10)
            Console.Write("Very cold weather.\n");
            else if(tmp<20)
                        Console.Write("Cold weather.\n");
                    else if(tmp<30)
                               Console.Write("Normal in temp.\n");
                            else if(tmp<40)
                                         Console.Write("Its Hot.\n");
                                    else
                                           Console.Write("Its very hot.\n");

}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now