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
Please give me a clue
Started by th3cl41, Feb 09 2009 06:58 AM
4 replies to this topic
#1
Posted 09 February 2009 - 06:58 AM
|
|
|
#2
Posted 09 February 2009 - 09:10 AM
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?
2) what questions do you have about the sequence?
#3
Posted 09 February 2009 - 06:15 PM
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?
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
Posted 10 February 2009 - 04:08 AM
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.
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.
#5
Posted 10 February 2009 - 07:36 AM
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.
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


Sign In
Create Account

Back to top









