{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

C Programming

# C Programming - Sum=sum temperature avg=sum/temperature...

This preview shows pages 1–3. Sign up to view the full content.

/* Shelley Dickson */ /* February 14, 2008 */ /* COP 2221-001 */ /* Program 5 */ #include <stdio.h> #define SENTINEL -99 /* Sub Functions */ Void accumulators(void) int main(void) { int temperature; /* Temperature */ double sum; /* Sum of temperatures */ double avg; /* The average temperature */ double pleasant; /* Pleasant temperature */ double cold; /* Cold temperature */ double hot; /* Hot temperature */ double low; /* Low temperature */ double high; /* High temperature */ /* Prompt for temperature and store. */ Printf(“Enter the temperature >”); Scanf(“%d”, &temperature);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
While (score !=sentinel) { Temperature=temperature+1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sum=sum+temperature avg=sum/temperature Printf(“Enter next score (%d to quit)> “, -SENTINEL); Scanf(“%d”, &temperature); /* Get next temperature */ } accumulators (); Printf(“\nSum of exam scores is %d\n”, sum); return(0); } void accumulators(void) { if (temperature>87) hot=hot+1; If (temperature<87) )&&(temperature>60) Pleasant=pleasant+1; else cold=cold+1; if (temperature>high) high=temperature if (temperature<low) low=temperature if (temperature=SENTINEL) printf(“%d pleasant days, %d hot days, and %d cold days.\n”, pleasant, hot, cold );...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

C Programming - Sum=sum temperature avg=sum/temperature...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online