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 can I open a file so that other programs can update it at the same time?
praagnovation
Who developed c language and when?
What does %p mean?
How can I find out how much free space is available on disk?
What happens if you free a pointer twice?
Explain modulus operator. What are the restrictions of a modulus operator?
Explain how can I convert a string to a number?
Is fortran still used today?
What is a program?
Write a program to swap two numbers without using third variable?
Explain how can you tell whether a program was compiled using c versus c++?
What does %d do?
Explain what is the advantage of a random access file?
What does it mean when the linker says that _end is undefined?