Here is the question:
Given the integer variables x , y , and z , write a fragment of code that assigns the smallest of x , y , and z to another integer variable min .
Assume that all the variables have already been declared and that x , y , and z have been assigned values).
---------------------------------------------------------------------------------------------------------------
This is the code I have, but when sumbit it the computer says that it is wrong. Could someone please tell me what is wrong with the program. Thanks.
Code:min ( x , y , z ) { min = x ; if(x < y && x < z) { min = x; return min; } if((y < x) && (y < z)){ min = y; return min; } if((z < x) && (z < y)){ min = z ; return min; }



LinkBack URL
About LinkBacks



