please tell me the logic for this C program :
INPUT (string):ABCD

OUTPUT :BCDA
CDAB
DABC

Answer Posted / sky

char str[]="ABCD";
len = strlen(str);
for (i=1; i < len; ++i )
{
j=i;
for( count=0; count < len; ++count, ++j )
{
if(j == len )
j=0;
printf("%c", (*str)+j);
}

printf("\n");
}

Is This Answer Correct ?    18 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is time null in c?

583


Explain what are compound statements?

605


How can you call a function, given its name as a string?

714


Can main () be called recursively?

630


Can a variable be both const and volatile?

676






What is a program flowchart and how does it help in writing a program?

665


Do pointers take up memory?

658


What happens if you free a pointer twice?

610


What does the file stdio.h contain?

608


How do I copy files?

623


What is break in c?

587


can we change the default calling convention in c if yes than how.........?

2035


What is strcmp in c?

598


Is main a keyword in c?

632


How do you do dynamic memory allocation in C applications?

630