Write a program to accept two strings of Odd lengths. Then
take all odd characters from one string and even characters
from the other and concatenate and produce a string.



Write a program to accept two strings of Odd lengths. Then take all odd characters from one string..

Answer / mani

#include<stdio.h>
void main()
{
char *str1[10],*str2[10],str3[10],str[4];
boolean check1,check2;
int i=0,j=1;
do
printf("enter the first string of odd length");
scanf("%s",str1);
printf("enter the second string of odd length");
scanf("%s",str2);
check1=testlen(&str1);
check2=testlen(&str2);
}
while(check1!=true && check2!=true);

while( *str1!='/o' || *str2!='/o')
{
if(str1[i]!='/o)
str3[i]=str1[i];

if(str2[i]!='/o)
str3[i+1]=str2[i];

i+=2;
}

while( *str1!='/o' || *str2!='/o')
{
if(str1[j]!='/o)
str4[j]=str1[j];

if(str2[j]!='/o)
str4[j+1]=str2[j];

i+=2;
}
printf("The value of string1 is %s",str1);
printf("The value of string1 is %s",str2);
printf("The value of string1 is %s",str3);
printf("The value of string1 is %s",str4);

}

boolean testlen(char *c) //function
{
int count;
while(*c++!='/o')
count++;
if(count%2!=0)
return true;
else
return false;
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C C++ Errors Interview Questions

which typw of errors ? & how to solve it ?

0 Answers  


what is the large sustained error signal that eventually cause the controller output to drive to its limit

1 Answers   TCS,


What is the out put of this programme? int a,b,c,d; printf("Enter Number!\n"); scanf("%d",&a); while(a=!0) { printf("Enter numbers/n"); scanf("%d%d%d",&b,&c,&d); a=a*b*c*d; } printf("thanks!"); getche(); Entering numbers are a=1,b=2,c=3,d=4 b=3,c=4,d=-5 b=3,c=4,d=0

5 Answers   TCS,


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,


char* f() return "hello:"; void main() {char *str=f(); }

1 Answers  






printy(a=3,a=2)

3 Answers  


Answering Yes or No in C++...using only stdio.h and conio.h..........help me please...? here's must be the output of the program: Screen A Exam No. items Score 1 20 20 2 35 35 Another Entry? [Y] or [N] : Screen B: Record No. Student's Name: 1 Fernando Torres 2 Chuck Norris Note: if you press Y, the program must repeat the procedure in screen A, then if N, the program must proceed to the screen B....Please Help me out............

1 Answers  


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;

2 Answers  


Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.

3 Answers  


Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.

1 Answers  


what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?

2 Answers   TCS,


Categories