Write a program that accepts a string where multiple spaces
are given in between the words. Print the string ignoring
the multiple spaces.
Example:
Input: “ We.....Are....Student “ Note: one .=1 Space
Output: "We Are Student"
Answer Posted / jyotsna
/* Assume ' ' at the place of '.' */
#include<conio.h>
#include<stdio.h>
void main()
{
char *s="Hello...this...is...jyotsna";
int i=0;
clrscr();
while(*s!='\0')
{
if(*s!='.')
{
printf("%c",*s);
i=0;
s++;
}
else
{
while(*s=='.')
s++;
printf(".");
}
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is equivalent to ++i+++j?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Write the syntax and purpose of a switch statement in C.
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What are the 5 elements of structure?
What are multibyte characters?
How can I implement a delay, or time a users response, with sub-second resolution?
Describe static function with its usage?
What is volatile keyword in c?
How many types of arrays are there in c?
What do you know about the use of bit field?
What is the purpose of ftell?
Explain what is wrong with this program statement? Void = 10;
What is difference between far and near pointers?
What is extern storage class in c?