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.
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 |
printy(a=3,a=2)
how to convert decimal to hexadecimal without using arrays just loops
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
write a profram for selection sort whats the error in it?
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
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?
Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.
main() { char c; for(c='A';c<='Z';c++) getch(); }
What is the code for following o/p * * * * * * * * * * * * * * * *
what is syntax error?
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.