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.
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
#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)
}
}