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

True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


Why do we use int main instead of void main in c?

0 Answers  


How will you write a code for accessing the length of an array without assigning it to another variable?

0 Answers  


sir, i cannot find the way how to write aprogram by using array on queue

1 Answers   IISIT,


Write a program that an operator and two operands read from input operand operator on the implementation and results display.

0 Answers  


void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?

7 Answers  


Explain this code. #include <stdio.h> void f1(int *k) { *k = *k + 10; } main ( ){ int i; i = 0; printf (" The value of i before call %d \n", i); f1 (&i); printf (" The value of i after call %d \n", i); }

3 Answers   IBM,


main() { float f1=10.5; double db1=10.5 if(f1==db1) printf("a"); else printf("b") }

2 Answers   CSC,


write a program to convert a expression in polish notation (postfix) to inline (normal)

0 Answers   Siemens,


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

0 Answers  


The variables are int sum=10,SuM=20; these are same or different?

3 Answers  


What are type modifiers in c?

0 Answers  


Categories