-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermutation.c
37 lines (37 loc) · 855 Bytes
/
permutation.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,k,j,a[10],frt,end;
clrscr();
printf("no.of numbers");
scanf("%d",&n);
printf("enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(k=1;k<=n;k++)
{
for(frt=0;frt<=n-k;frt++)
{
if(k!=1)
{
end=frt+k-1;
for(j=end;j<n;j++)
{
for(i=frt;i<end;i++)
{
printf("%d",a[i]);
}
printf("%d\n",a[j]);
}
}
else
{
printf("%d\n",a[frt]);
}
}
}
getch();
}