C Program to Check Temperature (Hot, Normal, Cold) in Hindi

आज हम C में एक program बनाने वाले है जो user से temperature लेगा, और उस temperature के आधार Program हमें Hot, Normal या फिर Cold Message Display करेगा। 

Program Statement 

C Language में एक program लिखिए हो जो user से temperature Input लें, और निचे दिए गये temperature के आधार पर Hot, Normal, Cold जैसे message print करे। 

  • Temperature  30 या 30 से ज्यादा होने पर – print “Hot “
  • Temperature  15 से ज्यादा और 30 से कम होने पर – print “Normal “
  • ऊपर की दोनों Condition False होने पर – print “Cold “

Program Code 

#include <stdio.h>

int main()
{
    float temp;

    printf("Enter temperature in degree Celsius: ");
    scanf("%f", &temp);

    if (temp >= 30)
    {
        printf("Hot");
    }
    else if (temp >= 15)
    {
        printf("Normal");
    }
    else
    {
        printf("Cold");
    }

    return 0;
}

Program Output:

Enter temperature in degree Celsius: 44

Hot

Code Explanation (Step-by-Step)

Finally चलिये अब Code को समझते हैं:

#include <stdio.h>

Stdio.h एक predefined Library है। इस program में printf() और scanf() को use करने के लिये किया गया है। 

float temp ;

float type और temp नाम का यह variable declare किया गया है temperature को store करने के लिये। 

User से temperature लेने के लिये 

printf(“Enter temperature in degree Celsius: “);

इस लाइन का use user को temperature input करने के लिये message display करने के लिए है। 

    scanf(“%f”, &temp);

User जो temperature की value enter करेगा उस value को temp variable में store करने के लिये scanf() function का use  किया गया है। 

Program logic

if(temp >= 30)

temp की value अगर 30 या 30 से ज्यादा है, तो if statement वाला condition execute होगा और “Hot” message display होगा। 

else if (temp >= 15)

लेकिन अगर temp की value 15 से ज्यादा और 30 से कम है तो, else if वाला block execute होगा और “Normal” message print होगा। 

 else statement

अगर if और else if condition होती है तो else वाला message display होगा। 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top