Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

BRACKEYS - Solution to C# Tutorial 05 Challenge

2»

Comments

  • I did mine a bit different but got the same result, also thx for these tutorials, they've been really helping me out in learning how to code.


    using System;

    using System.Collections.Generic;


    namespace My_Awrsome_Program

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Write("How many students are in your class: ");

                int students;

                students = Convert.ToInt32(Console.ReadLine());


                string[] amountOfStudents = new string[students];


                Console.WriteLine("Please name them all: ");

                

                for (int i = 0; i < students; i++)

                {

                    amountOfStudents[i] = Console.ReadLine();

                }

                

                Console.WriteLine("-------------------------");


                Array.Sort(amountOfStudents);

                for (int i = 0; i < students; i++)

                {

                    Console.WriteLine(amountOfStudents[i]);

                }

                


                // Wait before closing

                Console.ReadKey();

            }

        }

    }

Sign In or Register to comment.