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 |
what is syntax error?
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
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.
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;
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix 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 decimal to binary in c using while loop without using array
50 Answers Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,
wap for bubble sort