Friday, October 14, 2011

IF Statement (Number 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 T;
  
         p("Enter temperature: ");
         s("%d",&T);
  
              if ( T < 20 )
                  {
                  p("IT'S COLD!");
                  }
             else
             if ( T > 30 )
                 {
                 p("IT'S HOT!");
                 }
            else
                {
                p("COOL CLIMATE!");
                }
       getch ();
       return 0;
    }  

0 comments:

Post a Comment