using System; using System.Collections.Generic; using System.Text; namespace methodExamples { class Program { static void Main() { //call the display method Display(); // pause for a key Console.ReadKey(); }//end of main //this method takes a number as a parameter //and return the square root of that number static double GetSquareRoot(double num) { // assign the square root returned //from Math.Sqrt method double square = Math.Sqrt(num); //return the squareroot to the calling //method return square; }// end GetSquareRoot //this method displays the prompts //gets the input, calls the GetSquareRootMethod //and displays the result static void Display() { //display the prompt Console.WriteLine("Enter a number"); //get the number from the console double number = double.Parse(Console.ReadLine()); //call the GetSquareRoot method, pass it the //number from the console //and assign the return value to squareRt double squareRt = GetSquareRoot(number); //Display the results Console.WriteLine(" Square root of {0} is {1}", number, squareRt); }// end display }//end program class }//end namespace