adspace
Here is alphabets : abcdefgh
1) how to reverse. as hgfedcba
2) after reversal, how to group them in a pair hg fe dc ba.
Answer Posted / srinivas
1)Ans:
its simple find the string length say K
now run a a loop from 0 to K/2 incrementing by 1 every time
and swap the elements as
for(i=0;i<K/2;i++)
{
temp=a[i];
a[i]=a[K-(i+1)]
a[K-(i+1)]=temp;
}/*this is to reverse the string*/
2)Ans:
for(i=0;i<K;i++)
{
printf("%c",a[i]);
if((i+1)%2==0)
printf(" ");
}/*this is for printing in groups*/
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Is int a keyword in c?
write a progrmm in c language take user interface generate table using for loop?
What are compound statements?
What is the general form of a C program?
what is ur strangth & weekness
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
Do you know the difference between malloc() and calloc() function?
How do you determine the length of a string value that was stored in a variable?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What is pointers in c with example?
What is pointer to pointer in c with example?
How can I implement sets or arrays of bits?
write a c program to find the sum of five entered numbers using an array named number
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
hi send me sample aptitude papers of cts?