Pages

Wednesday, October 12, 2011

9. Write a program that will display "IT'S COLD!" if the temperature is less than 20, "IT'S HOT!" if the temperature is greater than 30, "COOL CLIMATE!" otherwise.

#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf

int main()
{
     int A;
    
     p("enter your temperature:");
     s("%d", &A);
     if(A<=20)
     p("IT'S COLD!");
     else if (A<=30)
     p("COOL CLIMATE!");
     else if(A>=30)
     p("IT'S HOT!");
     getch();
     return 0;
     }
    

4 comments: