Friday 4 July 2014

Write C# code to declare a variable to store the age of a person. Then the output of the program is as an example shown below:

You are 20 years old.
Solution:
using System;
­using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Csharp_exercises
{
class Program
{
static void Main(string[] args)
{
int age = 20;// declaring variable and assign 20 to it.
Console.WriteLine("You are {0} years old.",age);
Console.ReadLine();
}
}

}

1 comment: