Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Generation of lucky numbers out of given set of nos (http://www.go4expert.com/forums/generation-lucky-set-nos-t19305/)

 amanbaua 4Sep2009 19:49

Generation of lucky numbers out of given set of nos

Code:

```/*THE LOGIC BEHIND THIS PROGRAM IS THAT SUPPOSE THERE IS A SET OF NOS 1 2 3 4 5 6 7 8 9 10 FIRST EVERY 2ND NO IS DELETED WE GET 1 3 5 7 9 THEN EVERY 3RD NO IS DELETED 1 3 7 9 THEN EVERY 4TH NO IS DELETED 1 3 7 THEN EVERY 5TH NO IS DELETED AS THER IS NO 5TH NO SO THE LUCKY NOS ARE 1 3 7*/ #include"stdio.h" #include"conio.h" void main() {   int i,k=0,p=2,t=0,n;int a[100];   printf("enter the size of the array:\n");   scanf("%d",&n);   printf("enter the elements of the array\n");   for(i=0;i<n;i++)   {     scanf("%d",&a[i]);   }   printf(" The Sequence Of Lucky Nos Per Step Are:\n");   for(i=0;i<n;i++)   {     printf("%d",a[i]);     printf("\t");   }   while(1)   {     t=0;     for(i=0;i<n;i++)   {     if(a[i]!=32767)     {         k++;         if(k==p)         {           a[i]=32767;t++;           k=0;         }       }     }         p++;k=0;         if(t==0)         {               break;         }         printf("\n");             for(i=0;i<n;i++)         {             if(a[i]!=32767)           {         printf("%d ",a[i]);         printf("\t");           }         }         printf("\n");     }     getch();  }```

 xpi0t0s 5Sep2009 01:57

Re: Generation of lucky numbers out of given set of nos

Unless the code is different, I haven't checked for that.
Posting duplicate threads is a good way to get banned; please don't do that (unless getting banned is your aim of course).

 amanbaua 5Sep2009 09:07

Re: Generation of lucky numbers out of given set of nos

hey mr mentor both i mean 2 say both the article and the thread r posted by me
its d same amanbaua
understand

Re: Generation of lucky numbers out of given set of nos

Quote:
 Originally Posted by xpi0t0s (Post 56881) Posting duplicate threads is a good way to get banned ....
:rofl: :rofl:

Quote:
 Originally Posted by amanbaua (Post 56883) hey mr mentor both i mean 2 say both the article and the thread r posted by me its d same amanbaua understand
The last one you posted was transferred to the queries forum, it's not an article.
And, I think xpi0t0s perfectly understands the facts that :
(1) both are the same.
(2) both are posted by you.

======