Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Feel free to optimize the code and send it to the Facebook page, I'll put your name on it...
- //https://www.facebook.com/AminproPastebin
- #include <stdio.h>
- int main(){
- float num =0;
- float max = 0;
- float min = 0;
- float avg = 0;
- float total =0;
- printf("Enter temperature data for MON: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for TUE: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for WED: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for THU: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for FRI: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for SAT: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- printf("Enter temperature data for SUN: ");
- scanf("%f", &num);
- if(num>max){
- max = num;
- }
- else {
- min = num;
- }
- total = total + num;
- avg = total/7.0;
- printf("\nThe minimum temperature is %.1f Celcius\n", min );
- printf("The maximum temperature is %.1f Celcius\n", max);
- printf("The average temperature for one week is %.1f Celcius", avg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement