#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int fact(int n);
void main()
{
char a[20],st_char;
static int i,j,k,n,ctr,main_ctr;
printf("Enter the string : ");
//gets(a);
scanf("%s",a);

n=strlen(a);

if(n<=1)
{
printf("please enter a valid string ");
exit(0);
}

//label :
while(main_ctr<n)      //loop till length
{
for(i=0;i<=n-2;++i)    //loop to print first character of string ex abc,acb
{
ctr=0;
printf("\n");
printf("%c",a[0]);
    for(j=i+1;j<=n-1;j++)    //take
    {
        printf("%c",a[j]);
        ctr++;
    }

    if(ctr!=n-1)
    {
        for(k=1;k<=i;k++)//  print characters that left in above loop ex
from above i=2 print a[0], then j=3 print a[3], means to print a[1] and a[2]

        {
        printf("%c",a[k]);
        ctr++;
        }
    }
}

st_char=a[0];        //ex for abc string this change as a[0]=b;
for(i=0;i<=n-2;i++)    //a[1]=c;
    a[i]=a[i+1];    //a[2]=a;

a[n-1]=st_char;

main_ctr++;
}
printf("\n>>>>>Designed by Manish Pathak<<<<<<<< ");
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to