Click to See Complete Forum and Search --> : [ask] Algolrithm to write series number


th3cl41
February 9th, 2009, 01:59 AM
What Algolrithm to write series number ?

12345*678*910111213*141516*1718192021*....

Quiz 2: Write the following on the screen:
AAAAAAAAAA000
AAAAAAAAAA001
.............
AAAAAAAAAA999
AAAAAAAAAB000
.............
ZZZZZZZZZZ999

th3cl41
February 9th, 2009, 04:28 AM
give me a clue master

th3cl41
February 21st, 2009, 10:21 PM
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

int ct = 1;
int a=5, b=3, c=0;

for (int i = 1; i <= 25; i++)
{

Console.Write(" "+i);

if (ct == a)
{
c = a;
a = b;
b = c;

Console.Write("*");
ct = 0;
}

ct += 1;

}
Thread.Sleep(100);
}
}
}

cs19844
March 6th, 2009, 07:14 PM
int i = 0;
char str[] = "AAAAAAAAA000";

while(1)
{
printf("%s\n", str);

i = strlen(str) - 1;
while( str[i] == '9' )
{
str[i] = '0';
i--;
}
while( i>=0 && str[i] == 'Z' )
{
str[i] = 'A';
i--;
}
if(i < 0)
{
// We are done.
break;
}
str[i]++;
}