/* C#: The Complete Reference by Herbert Schildt Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // Use out. using System; class Decompose { /* Decompose a floating-point value into its integer and fractional parts. */ public int parts(double n, out double frac) { int whole; whole = (int) n; frac = n - whole; // pass fractional part back through frac return whole; // return integer portion } } public class UseOut { public static void Main() { Decompose ob = new Decompose(); int i; double f; i = ob.parts(10.125, out f); Console.WriteLine("Integer portion is " + i); Console.WriteLine("Fractional part is " + f); } }