Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are identifiers and keywords in c?

1201


show how link list can be used to repersent the following polynomial i) 5x+2

2402


What is function pointer c?

1192


What are the types of variables in c?

1089


What is a rvalue?

1263


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.

2155


When is a “switch” statement preferable over an “if” statement?

1215


Tell me what is null pointer in c?

1133


What is the difference between malloc() and calloc()?

1991


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

1140


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1772


Write a program for Overriding.

1214


What are the advantages of using Unions?

1172


What is cohesion and coupling in c?

1099


Why is %d used in c?

1061