The program must print Hot if the given temperature value is more than 30, must print Cold if the given value is less than 22. Else the program must print Normal.
Example Input/Output 1:
Input:
25
Output:
Normal
Example Input/Output 2:
Input:
34
Output:
Hot
Example Input/Output 3:
Input:
18
Output:
Cold
Python
N = int(input())
if N > 30:
print('Hot')
elif N < 22:
print('Cold')
else:
print('Normal')
Java
import java.util.*;
import java.util.*;
public class Hello {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
if (N > 30) {
System.out.print("Hot");
} else if (N < 22) {
System.out.print("Cold");
} else {
System.out.print("Normal");
}
}
}
C
#include <stdlib.h>
#include <stdio.h>
int main()
{
int N;
scanf("%d", &N);
if(N > 30)
{
printf("Hot");
}
else if(N < 22)
{
printf("Cold");
}
else
{
printf("Normal");
}
}
C++
#include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
if(N > 30)
{
cout << "Hot";
}
else if(N < 22)
{
cout << "Cold";
}
else
{
cout << "Normal";
}
return 0;
}
Leave a Reply