Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Provided is a struct that holds a color (see last week\'s assignment). The color

ID: 3574844 • Letter: P

Question

Provided is a struct that holds a color (see last week's assignment). The color consists of three unsigned ints representing the saturation of red, green and blue. Write a function (named "average_saturation") that returns the average saturation of a color. Example: The color orange (255, 128, 0) has an average saturation of -127.7 ((255 + 128 + 0)/3). #include struct Color {unsigned int red; unsigned int green; unsigned int blue;}; float average_saturation(struct Color c); int main (void) {struct Color c; scanf("%d %d %d', &c.red;, &c.green;, &c.blue;); float avg = average_saturation(c); printf("%.If", avg); return 0;}

Explanation / Answer

float average_Saturation(Struct Color c){

float i;

i = ((c.red + c.green + c.blue) / 3.0);

return i;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote