{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab7_Examplecode

# Lab7_Examplecode - Input parameters a b and c are all...

This preview shows page 1. Sign up to view the full content.

1 C:\ali\pres\hes1300\2010\Lab Notes\lab6\week6-lab-example.c /* This program finds the average , the largest , the smallest and the median of the three integers read from the keyboard . Written by : Date : */ # include < stdio . h > /* Prototype declarations */ float myAverage ( int x , int y , int z ) ; int myMax ( int x , int y , int z ) ; int main () { int a , b , c , max ; float avg ; printf ( " Enter the first integer \ n " ) ; scanf ( "% d " ,& a ) ; printf ( " Enter the second integer \ n " ) ; scanf ( "% d " ,& b ) ; printf ( " Enter the third integer \ n " ) ; scanf ( "% d " ,& c ) ; avg = myAverage ( a , b , c ) ; printf ( " The average of the given values is : % f \ n " , avg ) ; max = myMax ( a , b , c ) ; printf ( " The largest of the given values is : % d \ n " , max ) ; return ( 0 ) ; } /* This function adds all the inputs and returns the average
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . Input : parameters a , b and c are all integers Output : average of a , b and c . The function returns a floating point value . */ float myAverage ( int x , int y , int z ) { float temp ; temp = ( x + y + z )/ 3 . ; return temp ; } /* This function returns the largest value . Input : parameters x , y and z are all integers Output : largest of x , y and z . The function returns an integer . */ int myMax ( int x , int y , int z ) { int temp ; if ( y > x ) { temp = y ; } else { temp = x ; } if ( temp > z ) { return temp ; } else { return z ; } }...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern