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
What are identifiers and keywords in c?
show how link list can be used to repersent the following polynomial i) 5x+2
What is function pointer c?
What are the types of variables in c?
What is a rvalue?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
When is a “switch” statement preferable over an “if” statement?
Tell me what is null pointer in c?
What is the difference between malloc() and calloc()?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Write a program for Overriding.
What are the advantages of using Unions?
What is cohesion and coupling in c?
Why is %d used in c?