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

In a byte, what is the maximum decimal number that you can accommodate?

1147


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1042


Explain is it better to bitshift a value than to multiply by 2?

1206


What is unary operator?

1111


How we can insert comments in a c program?

1136


How many parameters should a function have?

1200


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

2140


What is page thrashing?

1090


What is a good way to implement complex numbers in c?

1055


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1985


How would you rename a function in C?

1052


What are qualifiers in c?

1043


Explain what are compound statements?

1068


Explain what is the advantage of a random access file?

1126


Write a program to know whether the input number is an armstrong number.

1131