answersLogoWhite

0

#include<stdio.h>

#include<string.h>

int main()

{

char a[80];

int rotated_element_number[80];

int rotation;

int i;

int length;

printf("enter the word: \n");

gets(a);

length = strlen(a);

printf("the reversed string is:\n");

for( rotation=0; rotation<length; rotation++)

{

for( i=0; i<length; i++)

{

rotated_element_number[i] = i + rotation;

while(rotated_element_number[i] > (length-1)) rotated_element_number[i] -= length;

printf("%c", a[rotated_element_number[i]]);

}

printf("\t");

}

getchar();

return 0;

}

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
BeauBeau
You're doing better than you think!
Chat with Beau
ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi

Add your answer:

Earn +20 pts
Q: Write a program that give all the rotations of a string?
Write your answer...
Submit
Still have questions?
magnify glass
imp