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

which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....

2 Answers  


what will happen if you free a pointer twice after allocating memory dynamically ?

3 Answers   Novell,


How do we declare variables in c?

0 Answers  


Write a program to print “hello world” without using semicolon?

0 Answers  


Can we replace the struct function in tree syntax with a union?

0 Answers   Huawei,






c pgm count no of lines , blanks, tabs in a para(File concept)

2 Answers  


what is use of loop?

10 Answers   Infosys,


write a function that accepts an array A with n elements and array B with n-1 elements. Find the missing one in array B,with an optimized manner?

2 Answers   Zensar,


what is the difference between c and c++?

7 Answers  


What are header files in c?

0 Answers  


what are the 10 different models of writing an addition program in C language?

0 Answers  


Can we assign integer value to char in c?

0 Answers  


Categories