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
What is time null in c?
Explain what are compound statements?
How can you call a function, given its name as a string?
Can main () be called recursively?
Can a variable be both const and volatile?
What is a program flowchart and how does it help in writing a program?
Do pointers take up memory?
What happens if you free a pointer twice?
What does the file stdio.h contain?
How do I copy files?
What is break in c?
can we change the default calling convention in c if yes than how.........?
What is strcmp in c?
Is main a keyword in c?
How do you do dynamic memory allocation in C applications?