Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, 2 June 2016

PROBLEM 7:
A manufacturer would like to have a device for a car that will turn on a light when the temperature is between 34 and 40 degrees Fahrenheit (F) and sound a warning signal when the outside temperature is 34 degrees F or below. The light and the sound are never going simultaneously. Write a C Program for solution to this problem. (Hint: Use the enter statement to input the present outside temperature. Print out what should happen, instead of actually turning on the light.


CODE:
#include<stdio.h>
main()
{
    int tempreature=0;
    printf("enter outside tempreature in Franheit\n");
    scanf("%d",&tempreature);
    if(tempreature>34 && tempreature<=40)
    {
        printf("light is on and warning sound play \n");
    }
    else if(tempreature<34)
    {
        printf("warning sound signal is on \n");
    }
     else if(tempreature==34)
    {
        printf("only light  play \n");
    }
    return 0;

}

PROGRAM OUTPUT:





For more problems click here

No comments:

Post a Comment