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

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

View Full Document Right Arrow Icon
/* 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);
Background image of page 1

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

View Full DocumentRight Arrow Icon
While (score !=sentinel) { Temperature=temperature+1
Background image of page 2
Background image of page 3
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)&gt; , -SENTINEL); Scanf(%d, &amp;temperature); /* Get next temperature */ } accumulators (); Printf(\nSum of exam scores is %d\n, sum); return(0); } void accumulators(void) { if (temperature&gt;87) hot=hot+1; If (temperature&lt;87) )&amp;&amp;(temperature&gt;60) Pleasant=pleasant+1; else cold=cold+1; if (temperature&gt;high) high=temperature if (temperature&lt;low) low=temperature if (temperature=SENTINEL) printf(%d pleasant days, %d hot days, and %d cold days.\n, pleasant, hot, cold );...
View Full Document

This note was uploaded on 05/27/2011 for the course COMPUTER S 101 taught by Professor Harmond during the Spring '07 term at FSU.

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 Right Arrow Icon
Ask a homework question - tutors are online