namespaceconsoleapplication8{classProgram {Static voidMain (string[] args) { #region // //There are a pair of young rabbits, the young rabbits grow into a rabbit one months later, one months after the rabbit into a rabbit. and gave birth to a pair of young rabbits, ////q How many pairs of rabbits, how many pairs of rabbits, how many pairs of rabbits, and how many rabbits are in a few years? // //The rabbit has a pair of young rabbits a month. //Console.WriteLine ("Please enter the month"); //int MM = Int. Parse (Console.ReadLine ()); //int ct = 0;//into a rabbit to initialize//int xt = 0;//Bunny Initialization//int yt = 1;//The baby Rabbit was just beginning to have a//int ZS = 1;//The total begins with a//for (int i = 1; I <= mm;i++)// { //if (i== 1)// { //ct = 0; //xt = 0; //YT = 1; //ZS = 1; // } //Else// { //ct = ct + xt; //XT =yt; //YT = ct; //ZS = ct + xt + YT; // } // } //Console.WriteLine (mm+ "months later" + "\ n" + "into the rabbit number is" +ct+ "\ n" + "Rabbit number is" +xt+ "\ n" +//"The number of young rabbits is" +yt+ "\ n" + "Total is" +zs); //console.readline (); #endregion #region ////Display time, display, day, month, hour, minute, second. //DateTime dt = DateTime.Now; //Console.WriteLine (DT); //Console.ReadLine (); //Displays the year, month, day, time, minute, and second. //DateTime dt = DateTime.Now; //string S; //s = dt. ToString ("yyyy mm month DD Day hh" mm minutes ss seconds "); //Console.WriteLine (s); //console.readline (); #endregion ////Enter a date to determine if it is correct //The try catch Exception statement uses theConsole.Write ("Please enter a date"); stringD =Console.ReadLine (); Try{DateTime dt=NewDateTime (); DT=DateTime.Parse (d); Console.Write ("Enter the correct"); } Catch{Console.Write ("wrong input"); } console.readline (); } }}
5.16 Bunny Rabbit, Date time practice