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

#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer

10 Answers   Wipro,


I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"

0 Answers  


how to convert decimal to binary in c using while loop without using array

50 Answers   Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,


what are the techniques for reducing the fragility of a memory bug?

1 Answers  


void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?

24 Answers   HCL,






What are the different types of errors in C and when they occur?

4 Answers  


what is meant by linking error? how can i solve it? if there is a linking error " unable to open file 'cos.obj'? then what should i do?

1 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  


difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?

2 Answers   TCS,


printy(a=3,a=2)

3 Answers  


wap for bubble sort

3 Answers  


How to reverse a linked list without using array & -1? Thank you.

2 Answers   Access, Satyam,


Categories