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

OUTPUT :BCDA
CDAB
DABC

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / rajan

Circular queue

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More C Interview Questions

Is Exception handling possible in c language?

0 Answers   Wipro,


hi send me sample aptitude papers of cts?

0 Answers  


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

0 Answers   Amazon,


6)swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } after calling swap ,what are yhe values x&y?

3 Answers  


what is event driven software and what is procedural driven software?

0 Answers  


Why doesn't C have nested functions?

2 Answers  


What is echo in c programming?

0 Answers  


If fflush wont work, what can I use to flush input?

0 Answers  


Explain what are global variables and explain how do you declare them?

0 Answers  


what is difference between #include<stdio.h> and #include"stdio.h"

4 Answers  


Explain enumerated types.

0 Answers  


How important is structure in life?

0 Answers  


Categories