main()
{
  char arr[]="abcde";
  int r = 3,i,count;
  int len;
  len = sizeof(arr)/sizeof(arr[0]);
  for(i=0;i<len-r;i++)
  {
    count = 0;
    while(count < r)
    {
      printf("%c\t", arr[i+count]);
      count++;
    }
    printf("\t\t");
  }
}

http://codepad.org/3n1qdS2R

On Wed, Jul 14, 2010 at 11:51 AM, ashita dadlani <ash....@gmail.com> wrote:

> @ashish:yours is not a generalized solution.Here you are assuming that u
> know r=3.
> What if we need to generalize the solution?
>
>
> On Wed, Jul 14, 2010 at 11:58 PM, Ashish Goel <ashg...@gmail.com> wrote:
>
>> for (int i=0;i<n-r+1;i++)
>> printf("%c%c%c ", a[i],a[i+1],a[i+2]);
>>
>>
>> Best Regards
>> Ashish Goel
>> "Think positive and find fuel in failure"
>> +919985813081
>> +919966006652
>>
>>
>>
>> On Wed, Jul 14, 2010 at 6:23 PM, ankit mahendru <
>> ankit.mahend...@gmail.com> wrote:
>>
>>> Write the code to print combinations of a given array (n& r were given)
>>> e.g for abcde .r=3 ...print " abc", "bcd' "cde" etc
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to