Thursday, October 1, 2015

First assignment example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AssignmentExamples
{
    class Program
    {
        //comments with your name 
        static void Main(string[] args)
        {
            //prompt
            Console.WriteLine("Enter your favorite color ");
            //getting input
            string colorChoice= Console.ReadLine();
            Console.WriteLine("Enter your favorite animal");
            string animal = Console.ReadLine();
            //output results with placeholders
            Console.WriteLine
                ("Your favorite color is {0}, and your favorite animal is a{1}"
                ,colorChoice, animal);
            
            //concatination
            Console.WriteLine("your favorite color is " + colorChoice +
                ", your favorite animal is a " + animal);

            //pause long enough to read it
            Console.ReadKey();


        }
    }
}

No comments:

Post a Comment