Programming Course in C# ¡Free!

Age

 Sunday, March 31, 2013 published by Exercises C#
Proposed exercise

Write a C# program to ask the user for his age (20, for instance) and answer something as "You look younger than 20" (instead of 20, you should display the age that has been entered).

Output



Solution


using System;
public class Age
{
public static void Main()
{
int age;
Console.Write("Enter a age ");
age = Convert.ToInt32(Console.ReadLine());
Console.Write("You look younger than {0} ",age);
}
}