This is a small one. Some time ago this table came in handy, testing out low level multiplication.
And I just love multiplication tables. We all do, now don't we? :)
An hexadecimal multiplication table
using System;
namespace HexMultiplicationTable
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hexadecimal multiplication table.");
Console.WriteLine();
for (int i = 1; i <= 16; i++)
{
for (int j = 1; j <= 16; j++)
{
if (i == j) Console.BackgroundColor = ConsoleColor.Gray;
else Console.BackgroundColor = ConsoleColor.Cyan;
Console.Write("{0,4:X}", i * j);
}
//go to the next line to start for j loop all over, with i+1
Console.WriteLine();
}
Console.WriteLine();
Console.WriteLine("The squares of the first 16 numbers:");
Console.WriteLine();
for (int j = 1; j <= 16; j++)
{
Console.Write("{0,4}", j * j);
}
Console.WriteLine();
Console.WriteLine("**************************************************");
Console.ReadKey();
}
}
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.