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 main () in c?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Where are local variables stored in c?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What is the difference between single charater constant and string constant?
Explain what are the advantages and disadvantages of a heap?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Why we not create function inside function.
Explain the difference between strcpy() and memcpy() function?
Should I learn c before c++?
What are the primitive data types in c?
What is the difference between the = symbol and == symbol?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is the use of the function in c?
What is the acronym for ansi?