Code: Select all
using System;
class Program
{
static void Main(string[] args)
{
int totalString=0;
string[] count = new string[] { "one", "two", "three", "four", "five", "six", "seven","eight","nine", "ten",
"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen",
"twenty", "twentyone", "twentytwo", "twentythree", "twentyfour", "twentyfive", "twentysix", "twentyseven",
"twentyeight", "twentynine", "thirty", "thirtyone", "thirtytwo", "thirtythree", "thirtyfour", "thirtyfive",
"thirtysix", "thirtyseven", "thirtyeight", "thirtynine","forty"};
for (int x = 0; x < count.Length; x++)
{
totalString += count[x].Length;
}
Console.WriteLine("String length for 1-40 is: {0}", totalString);
Console.ReadLine();
}
}