Is it hot or cold CodeChef Solution

Problem – Is it hot or cold CodeChef Solution

Chef considers the climate HOT if the temperature is above 20, otherwise he considers it COLD. You are given the temperature C, find whether the climate is HOT or COLD.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first and only line of each test case contains a single integer, the temperature C.

Output Format

For each test case, print on a new line whether the climate is HOT or COLD.

You may print each character of the string in either uppercase or lowercase (for example, the strings hOthotHot, and HOT will all be treated as identical).

Constraints

  • 1≤T≤50
  • 0≤C≤40

Sample 1:

Input: 2
21
16
Output: HOT
COLD

Explanation:

Test case 1: The temperature is 21, which is more than 20. So, Chef considers the climate HOT.

Test case 2: The temperature is 16, which is not more than 20. So, Chef considers the climate COLD.

Is it hot or cold CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
    int t,c;
    cin>>t;
    while(t--)
    {
        cin>>c;
        if(c>20)
        cout<<"HOT"<<"\n";
        else
        cout<<"COLD"<<"\n";
    }
	return 0;
}

Is it hot or cold CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int i=0;i<t;i++){
		    int n = sc.nextInt();
		    if(n>20){
		        System.out.println("HOT");
		    }else{
		        System.out.println("COLD");
		    }
		}
	}
}

Is it hot or cold CodeChef Solution in Pyth 3

t=int(input())
for i in range(t):
    x=int(input())
    if x>20:
        print("Hot")
    else:
        print("Cold")
Is it hot or cold CodeChef Solution Review:

In our experience, we suggest you solve this Is it hot or cold CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Is it hot or cold CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Is it hot or cold CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.