Yet another challenge solution


#1

[code]float remainingAngle (float angA, float AngB)
{
float leftOver = 180 - (angA + AngB);
return leftOver;
}

int main(int argc, const char * argv[])
{
float angleA = 30.0;
float angleB = 60.0;
float angleC = remainingAngle(angleA, angleB);
printf(“The third angle is %.2f.\n”, angleC);
return 0;
}
[/code]

Part way through, I was wondering how it knows that the leftOver returned becomes the valude for angleC, but then I realized it is set at angleC = remainingAngle() where angleC gets set to whatever the function returns.