Permutation: It means an arrangement of things. When we say arrangement then we consider the order of the things.
The formula to calculate permutation:
We calculate permutation formula, given as follow
Number of permutation of ‘n‘ different things taken ‘r’ at a time is given by,
npr = n!/(n-r)!

Suppose we have to form the number of consisting of three digits using the digits 1, 2 3,4. To form this number the digits have to be arranged. The different numbers will get formed depending upon the order in which we arrange the digits.

Combination: It means selection of the things. The order of things is considered where word selection is not important.
The formula to calculate Combination:
We calculate combination by formula, given as follow
nCr = n! / (n-r)! . r!

Suppose that we have to make a team of 11 out of the members 20.
This is an example of the combination because an order of the member will not result in a change in the team that is no matter. No matter in which order we choose and make the order of the team only making the team of 11 is important.

Algorithm to Calculate Permutation and Combination

  1. Declare variable.
  2. Take input n and r.
  3. Calculate permutation and combination.
  4. Print permutation and combination

C Program to Calculate Permutation and Combination

#include <stdio.h>
#include <conio.h>
main() {
int n , r, ncr( int , int);
long npr( int , int);
long double fact( int);
printf(" Enter value of n & r \n");
scanf("%d %d",&n , &r);
if( n>= r) {
printf( " %dC%d is %d\n", n,r,ncr( n , r));
printf(" %dP%d is %ld", n,r,npr( n, r));
} else {
printf("WRONG INPUT?? enter the correct input");
long double fact( int p) {
long double facts = 1;
int i;
for ( i = 1; i<= p; i++)
facts = facts * i;
return( facts);
int ncr ( int n, int r) {
return( fact( n) / (fact( r) * fact(n- r) ) ) ;
long npr( int n , int r) {
return( fact( n) / fact( n- r));

Output :

C Program to Calculate Permutation and Combination

Write A Comment