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
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
how to write optimum code to divide a 50 digit number with a 25 digit number??
Explain what standard functions are available to manipulate strings?
What is meant by high-order and low-order bytes?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
Explain enumerated types in c language?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
Which function in C can be used to append a string to another string?
What is c programing language?
What is the significance of c program algorithms?
What is the function of multilevel pointer in c?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
write an algorithm to display a square matrix.