A manufacturer would like to have a device for a car that will sound a warning signal when the temperature is between 34 and 40 degrees Fahrenheit (F). Write a logical expression to code the scenario in c program.

Questions & AnswersCategory: Programming LanguageA manufacturer would like to have a device for a car that will sound a warning signal when the temperature is between 34 and 40 degrees Fahrenheit (F). Write a logical expression to code the scenario in c program.
Fakhurddin asked 2 years ago

A manufacturer would like to have a device for a car that will sound a warning
signal when the temperature is between 34 and 40 degrees Fahrenheit (F). Write a
logical expression to code the scenario in c program.

1 Answers
Lokesh Kumar Staff answered 2 years ago
#include<stdio.h>
#include<conio.h>
#include<windows.h>
void main(){
    int tmp = 0;
    printf("Enter Temperature (in Fahrenheit): ");
    scanf("%d", &tmp);

    if (tmp>=34 && tmp <=40)
    {
        printf("Warning!, High Temperature");
        printf("\a"); //will work with speaker
        Beep(800, 300); //will work with mother-board's speaker (PC)
    }
}