Here is alphabets : abcdefgh
1) how to reverse. as hgfedcba
2) after reversal, how to group them in a pair hg fe dc ba.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ruchi
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int i,c;
char p[]="abcdefgh";
i=strlen(p);
for(c=i;c>=0;c--)
{
printf("%c",p[c]);
}
for(c=i;c>=0;c--)
{
printf("%c",p[c]);
if(c%2==0)
{
printf(" ");
}
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
a linear linked list such that the link field of its last node points to the first node instead of containing NULL a) linked list b) circular linked list c) sequential linked list d) none
what are two categories of clint-server application development ?
What is the translation phases used in c language?
Write a program to identify if a given binary tree is balanced or not.
what is the difference between static variable and register variable?
Explain what is wrong in this statement?
Write a program to check palindrome number in c programming?
Write a program that can show the multiplication table.
Is main is user defined function?
If you know then define #pragma?
What was noalias and what ever happened to it?
Write a C program to multiply tho numbers without using arithmetic operator (+, -, *, /).