25 lines
861 B
C
25 lines
861 B
C
//example of a simple program to display diffrent message for temperature
|
|
#include <stdio.h>
|
|
int main(){
|
|
// display the purpose of the program
|
|
printf("This program will display diffrent message for temperature.\n");
|
|
|
|
// define the variable temperature
|
|
float temperature = 77;
|
|
// check the temperature and display the message
|
|
if (temperature < 32){
|
|
printf("It is freezing outside.\n");
|
|
printf("Wear a coat.\n");
|
|
} else if (temperature < 50){
|
|
printf("It is cold outside.\n");
|
|
printf("Wear a jacket.\n");
|
|
} else if (temperature < 70){
|
|
printf("It is cool outside.\n");
|
|
} else if (temperature < 90){
|
|
printf("It is warm outside.\n");
|
|
} else {
|
|
printf("It is hot outside.\n");
|
|
}
|
|
return 0;
|
|
}
|