//* Boolean expressions *

#include <stdio.h> int main() { int temp; // daily average outside temperature int EC; // energy consumption level in % /* The state of energy conservationalert should be called if: the average daily temperature is above 90F and the energy consumptionlevel is above 80% or the average daily temperature is below 20F and the energy consumption level is above 80% or the energy consumption level is above 90% */ printf("Please enter the average daily temperature "); scanf("%d", &temp); printf("Please enter the current energy consumption level in \% "); scanf("%d", &EC); // if ( temp>90 && EC>80 || temp<20 && EC>80 || EC>90 ) // original bolean expression // if ( ( temp>90 && EC>80 ) || ( temp<20 && EC>80) || EC>90 ) // and with some () - (2*3)+4 // if ( ((temp>90) && (EC>80)) || ((temp<20) && (EC>80)) || (EC>90) ) // and with all possible () // if ( ( temp>90 || temp<20 ) && EC>80 || EC>90 ) // reduced expression // if ( (((temp>90)|| (temp<20)) && (EC>80)) || (EC>90) ) // and with all possible () if ( temp>90 && EC>80 || temp<20 && EC>80 || EC>90 ) printf("The Energy Conservation Allert should be announced!\n"); else printf("We have enough energy for now. Please always save energy.\n"); return(0); }