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 would you rename a function in C?
Explain spaghetti programming?
Where we use clrscr in c?
What is a char in c?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What does s c mean on snapchat?
Explain what is the heap?
Hai what is the different types of versions and their differences
What is the correct code to have following output in c using nested for loop?
using only #include
Write a program to generate random numbers in c?
Difference between goto, long jmp() and setjmp()?
What is pointer to pointer in c?
What is the use of ?
How variables are declared in c?