Sunday, October 16, 2011

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

No comments:

Post a Comment