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
How will you delete a node in DLL?
What is the difference between malloc() and calloc()?
What is the purpose of clrscr () printf () and getch ()?
What is meant by 'bit masking'?
What is the best way to store flag values in a program?
What are 3 types of structures?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Why string is used in c?
Is flag a keyword in c?
What is difference between class and structure?
diff between exptected result and requirement?
What is the difference between exit() and _exit() function in c?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Why is c used in embedded systems?
What does d mean?