function: is a block of code with input parameters, output parameters, return valuesnamespacehanshu{classClass1 {/// <summary> ///This is a measure of whether the body weight is a standard function/// </summary> /// <param name= "a" ></param> /// <param name= "B" ></param> /// <param name= "C" ></param> /// <returns></returns> Public stringBiaozhutizhong (intAintBintc)//modifier return value type function name input parameter (void is no return value type) { intD; if(c = =1) {D= A- -; if(B < D-3) { return"Skinny.";//return value } Else if(B > D-3) { return "I'm fat."; } Else { return "Normal"; } } Else if(c = =0) {D= A- the; if(B < D-3) { return "Skinny."; } Else if(B > D-3) { return "I'm fat."; } Else { return "Normal"; } } Else { return"you entered an error"; } }namespacehanshu{classProgram {Static voidMain (string[] args) {Console.WriteLine ("Please enter your height:"); intA =int. Parse (Console.ReadLine ()); Console.WriteLine ("Please enter your weight:"); intb =int. Parse (Console.ReadLine ()); Console.WriteLine ("Please enter Gender: (male-1, female -0)"); intc =int. Parse (Console.ReadLine ()); Class1 P=NewClass1 ();//Initialize//Class ObjectConsole.WriteLine (P.biaozhutizhong (A,b,c)); Console.ReadLine (); }}
12. Functions