exam02.c - #include <stdio.h>#include <stdlib.h>#include <math.h> main int number sum = 0 count = 0 double average printf"Enter whole a number

exam02.c - #include <stdio.h>#include <stdlib.h>#include...

This preview shows page 1 out of 1 page.

#include <stdio.h> #include <stdlib.h> #include <math.h> main(){ int number, sum = 0, count = 0; double average; printf("Enter whole a number between -50 and 100 (-999 to get results): "); scanf("%i" , &number); if(number > 100 ){ printf("Invalid number, must enter between -50 and 100, please try again: \n"); } while(number != -999){ count = count + 1; sum = sum + number;
Image of page 1

Unformatted text preview: printf(&quot;Enter whole a number between -50 and 100 (-999 to get results): &quot;); scanf(&quot;%i&quot;, &amp;number); } average = (double) sum / count; printf(&quot;You entered %i numbers \n&quot;,count); printf(&quot;\nThe sum of the numbers is %i\n&quot;, sum); printf(&quot;The average of the numbers you provided is %.2lf \n&quot;, average); system(&quot;pause&quot;); }...
View Full Document

  • Spring '17

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask bonus questions You can ask questions ( expire soon) You can ask questions (will expire )
Answers in as fast as 15 minutes