1.3: Challenge Answers

Bronze Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {
            //BRONZE
            int lottoNumber;
            int yearGraduatedHighSchool = 1994;

            string fbPost;
            string reTweet = "Yes, I'll retweet that.";

            bool isMarried;
            bool isHappy = true;

            decimal studentLoanAmount;
            decimal bankAccount = 100.0M;

            float amountOfSnow;
            float temperature = 57.5f;

            double latitude;
            double oneThird = 3.33333333d;

            fbPost = "The Patriots are terrible!";

            Console.WriteLine(fbPost);
            Console.WriteLine(temperature);
            Console.WriteLine(oneThird);
        }
    }
}

Silver Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {
            //SILVER
            string fbPost;
            string reTweet = "Yes, I'll retweet that.";
            fbPost = "The Patriots are terrible!";

            Console.WriteLine(fbPost + " " + reTweet);
        }
    }
}

Gold Challenge Answer (Example)

namespace BasicTypesPractice
{
    class Program
    {
        static void Main(string[] args)
        {     
            //GOLD
            int bYear = Int32.Parse("1976");       
            Console.WriteLine("I was born in {0}.", bYear);
        }
    }
}

Next: Strings

Last updated