Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

logic for generating all the combinations of the any number
of given letters.
ex:::::::::
if a,b,c,d are given the o/p should be
abcd,dcba,dbac,bcad,................
4*3*2*1 combinations............

Answer Posted / ashok kannan

#include<stdio.h>
#include<conio.h>
#include<string.h>

char a[10];
int m;

void permute(int n,int i)
{
int j;
for(j=i;j<m;j++)
{
printf("%c",a[j]);

if(n!=0)
{
permute(n-1,i+1);
}
else
{
printf("%c\n",a[j]);
}

}

void main()
{
printf("enter the string to be permuted");
scanf("%s",a);
m=strlen(a);
permute(m,0);
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the __date__ and __time__ preprocessor commands?

1179


Tell us the use of fflush() function in c language?

1203


What is difference between array and structure in c?

1272


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

1075


When is the “void” keyword used in a function?

1583


What are c preprocessors?

1245


Why we use conio h in c?

1304


Do you know the difference between exit() and _exit() function in c?

1113


What are preprocessor directives in c?

1156


I need a sort of an approximate strcmp routine?

1081


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1473


Is c is a high level language?

1256


how to introdu5ce my self in serco

2049


Explain what does the function toupper() do?

1136


if p is a string contained in a string?

1891