C# progran to generate voucher code
code:
using System;
namespace getvoucher
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Your voucher code is:");
Random rm = new Random();
for (int j = 1; j <=16;j++ )
{
int n = rm.Next(1,9);
Console.Write(n);
if (j%4==0)
{
if (j == 16)
{
Console.Write("");
}
else
Console.Write("-");
}
}
Console.ReadKey();
}
}
}
code:
using System;
namespace getvoucher
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Your voucher code is:");
Random rm = new Random();
for (int j = 1; j <=16;j++ )
{
int n = rm.Next(1,9);
Console.Write(n);
if (j%4==0)
{
if (j == 16)
{
Console.Write("");
}
else
Console.Write("-");
}
}
Console.ReadKey();
}
}
}
The output will be:
No comments:
Post a Comment