Author Topic: C Program for Temperature and Weather Condition Information  (Read 3066 times)


  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
C Program for Temperature and Weather Condition Information
« on: November 14, 2011, 11:53:53 am »
Write C/C++ program.which take input from the user as a temperature and display according if temperature b/w 0 to 10 the output will be weather is cold.if 10 to 20 (weather will be pleasant). if 20 to30 (weather will be going to hot). if 31 to 40 (weather will be hot). if above 41 then (weather will be burning)

//Source Code Listing

#include <stdio.h>

int main()
   double temperature;
   printf("Enter your temperature in Celsius (%cC): ", 248);
   scanf("%lf", &temperature);

   if(temperature < 0)
      printf("\n%.2lf %cC is VERY COLD", temperature, 248);
   else if(temperature <= 10)
      printf("\n%.2lf %cC is COLD", temperature, 248);
   else if(temperature <= 20)
      printf("\n%.2lf %cC is PLEASANT", temperature, 248);     
   else if(temperature <= 30)
      printf("\n%.2lf %cC is NEAR HOT", temperature, 248);     
   else if(temperature <= 40)
      printf("\n%.2lf %cC is VERY HOT", temperature, 248);     
      printf("\n%.2lf %cC is BURNING", temperature, 248);     


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1