11 Replies - 8321 Views - Last Post: 23 February 2010 - 08:36 AM Rate Topic: -----

#1 priya_lorha  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 78
  • Joined: 02-August 08

TO PRINT LUCKY NUMBERS

Posted 25 October 2008 - 09:24 PM

I have no idea about the logic help!!!! plz







the out will be
[1, 3, 7, 9, 13, 15, 21, 25, 27, 31, 33, 37, 43, 45, 49]
Is This A Good Question/Topic? 0
  • +

Replies To: TO PRINT LUCKY NUMBERS

#2 absynthe  Icon User is offline

  • DIC Tease
  • member icon

Reputation: 28
  • View blog
  • Posts: 2,807
  • Joined: 20-September 08

Re: TO PRINT LUCKY NUMBERS

Posted 25 October 2008 - 11:11 PM

how can anyone answer this?


System.out.print(" 1, 3, 7, 9, 13, 15, 21, 25, 27, 31, 33, 37, 43, 45, 49 ");

This post has been edited by absynthe: 25 October 2008 - 11:13 PM

Was This Post Helpful? 1
  • +
  • -

#3 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1377
  • View blog
  • Posts: 10,951
  • Joined: 06-February 08

Re: TO PRINT LUCKY NUMBERS

Posted 26 October 2008 - 09:56 AM

I think you're looking to output odd numbers~

Try this:

for (int i = 1; i < 50; i += 2) {
    System.out.print(i.toString() + " ");

Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: TO PRINT LUCKY NUMBERS

Posted 26 October 2008 - 08:46 PM

View Postgabehabe, on 26 Oct, 2008 - 09:56 AM, said:

I think you're looking to output odd numbers~

Try this:

for (int i = 1; i < 50; i += 2) {
    System.out.print(i.toString() + " ");

NO: 11, 17, 23, ... are missing must be something else
Was This Post Helpful? 0
  • +
  • -

#5 westforduk  Icon User is offline

  • D.I.C Head

Reputation: 24
  • View blog
  • Posts: 140
  • Joined: 16-August 07

Re: TO PRINT LUCKY NUMBERS

Posted 26 October 2008 - 08:47 PM

I think the program is supposed to output random numbers between 1-49 and all being unique.
Not sure though.

Actually maybe not.

Nevermind.

This post has been edited by westforduk: 26 October 2008 - 08:48 PM

Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: TO PRINT LUCKY NUMBERS

Posted 26 October 2008 - 09:19 PM

If priya_lorha tells us what a "lucky number is may be we can help
Was This Post Helpful? 0
  • +
  • -

#7 SanjitVignesh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 19-September 08

Re: TO PRINT LUCKY NUMBERS

Posted 26 October 2008 - 10:27 PM

The series goes in this order, the numbers are from 1 to 50.

The incrementation goes like this, +2, +4, +2,+4, +2, +6 and so on. Hope this clears the logical part.

I don't know how to put the code for it.

This post has been edited by SanjitVignesh: 26 October 2008 - 10:28 PM

Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: TO PRINT LUCKY NUMBERS

Posted 27 October 2008 - 05:19 PM

View PostSanjitVignesh, on 26 Oct, 2008 - 10:27 PM, said:

The series goes in this order, the numbers are from 1 to 50.

The incrementation goes like this, +2, +4, +2,+4, +2, +6 and so on. Hope this clears the logical part.

And what is the logic about 2,4,2,4,2,6 ? What is the next number
Was This Post Helpful? 0
  • +
  • -

#9 amitdhar  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 49
  • Joined: 01-February 08

Re: TO PRINT LUCKY NUMBERS

Posted 28 October 2008 - 05:56 AM

The logic is, from the series from 1 to 100 remove all the 2nd numbers, i.e.
1,3,5,7,9,11, ......

From the remaining numbers remove every third number i.e.
1,3,7,9,......

From the remaining remove every 4th number i.e.
1,3,7,......

this way the logic will proceed....
Was This Post Helpful? 1
  • +
  • -

#10 Gloin  Icon User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: TO PRINT LUCKY NUMBERS

Posted 28 October 2008 - 06:08 AM

Lucky numbers or not, I think we have to consider amitdhar the winner here.. And the prize is.. Sorry, no prize.. :(

Anyways, you use a boolean array[100], I'll use coffee..
Was This Post Helpful? 0
  • +
  • -

#11 Guest_Saswat*


Reputation:

Re: TO PRINT LUCKY NUMBERS

Posted 13 February 2010 - 12:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38..
(reject the +2 position no.s from the above series)
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73.
(reject the +3 position no.s from the above series)
1 3 7 9 13 15 19 21 25 27 31 33 37 39 43 45 49 51 55 57 61 63 67 69 73..
(reject the +4 position no.s from the above series)
1 3 7 13 15 19 25 27 31 37 39 43 49 51 55 61 63 67 73...
(reject the +5 position no.s from the above series)
1 3 7 13 19 25 27 31 39 43 49 51 61 63 67 73...
(reject the +6 position no.s from the above series)
1 3 7 13 19 27 31 39 43 49 61 63 67 73...
(reject the +7 position no.s from the above series)
1 3 7 13 19 27 39 43 49 61 63 67...
(reject the +8 position no.s from the above series)
1 3 7 13 19 27 39 49 61 63 67...
(reject the +9 position no.s from the above series)
1 3 7 13 19 27 39 49 63 67...
(reject the +10 position no.s from the above series)
1 3 7 13 19 27 39 49 63 ..
Was This Post Helpful? 0

#12 Guest_vicks_sid*


Reputation:

Re: TO PRINT LUCKY NUMBERS

Posted 23 February 2010 - 08:36 AM

View PostSaswat, on 13 February 2010 - 11:33 AM, said:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38..
(reject the +2 position no.s from the above series)
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73.
(reject the +3 position no.s from the above series)
1 3 7 9 13 15 19 21 25 27 31 33 37 39 43 45 49 51 55 57 61 63 67 69 73..
(reject the +4 position no.s from the above series)
1 3 7 13 15 19 25 27 31 37 39 43 49 51 55 61 63 67 73...
(reject the +5 position no.s from the above series)
1 3 7 13 19 25 27 31 39 43 49 51 61 63 67 73...
(reject the +6 position no.s from the above series)
1 3 7 13 19 27 31 39 43 49 61 63 67 73...
(reject the +7 position no.s from the above series)
1 3 7 13 19 27 39 43 49 61 63 67...
(reject the +8 position no.s from the above series)
1 3 7 13 19 27 39 49 61 63 67...
(reject the +9 position no.s from the above series)
1 3 7 13 19 27 39 49 63 67...
(reject the +10 position no.s from the above series)
1 3 7 13 19 27 39 49 63 ..


hey someone give the java program code to run this lucky no. process....
Was This Post Helpful? 0

Page 1 of 1