Jump to content

Please give me a clue

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
th3cl41

th3cl41

    Newbie

  • Members
  • Pip
  • 7 posts
Please help to solve this problems, what algolrithm / logic for solve this number series
1: Write the number from 1 to 1000 on the screen like the following in any programming language you love:
12345*678*910111213*141516*1718192021*....

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

thanks for the clue

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
1) what is the significance of the *'s in the sequence? Do you know how the sequence is created?

2) what questions do you have about the sequence?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
th3cl41

th3cl41

    Newbie

  • Members
  • Pip
  • 7 posts

WingedPanther said:

1) what is the significance of the *'s in the sequence? Do you know how the sequence is created?

2) what questions do you have about the sequence?

1 2 3 4 5 * 6 7 8 * 9 10 11 12 13 * 14 15 16 * 17 18 19 20 21 *

after 5 sequence print * and after 3 sequence print *

i need a logic how to print star (*) after series a number

this is my code
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = 0;
            int m = 0;
            int j = 5;
            int l = 3;


            for (int i = 1; i <= 30; i++)
            {
                k = k + 1;
                m = k;
                Console.Write(" "+i);

                if (((k%j)==0))
                {
                    j = j + l;                    
                    Console.Write("*");
                    m = m + j;
                    l = j;
                }
                //else if ((m % l) == 0)
                //{
                //    //l = l + j;
                //    Console.Write("*");
                //    //m = m + j;
                //}
            }
           
            int x = 0;
        }
    }
}
thanks for your clue

Edited by WingedPanther, 10 February 2009 - 04:04 AM.
change # to code to make working code tags


#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Suggestions:
1) use meaningful names on your variables so the logic is more transparent.
2) instead of using modulus, have k reset have each star is printed, and switch j between 3 and 5. Then you can just check if k==j.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
th3cl41

th3cl41

    Newbie

  • Members
  • Pip
  • 7 posts

WingedPanther said:

Suggestions:
1) use meaningful names on your variables so the logic is more transparent.
2) instead of using modulus, have k reset have each star is printed, and switch j between 3 and 5. Then you can just check if k==j.

thanks for the clue master :D, you right.....

i like coding :D