Is there any way to do a permutation program with conditions.. like enter "n" girls and "m" boys can stand in a line but without two girls standind together or something like that... is there any algorithm to do this..
Thanks in advance.

Could you please be more detailed and tell what the requirements of the program are?

Ok the program required to enter n numbers of distinct girls and m number of distinct boys. Then it produce a list of every possible way the boys and girls can be on a line if two girls can stand on the line together..
Example
m = 1 (number of boys)
n = 2 (number of girls)

all accepted permutations will be

N1, M1, N2
N2, M1, N1

it cant accept

M1, N1, N2
M1, N2, N1
N1, N2, M1
N2, N1, M1
Because two 'girls' are together

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.