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
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
How can I avoid the abort, retry, fail messages?
What is null pointer constant?
When should the volatile modifier be used?
Should a function contain a return statement if it does not return a value?
How are pointers declared in c?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
Calculate 1*2*3*____*n using recursive function??
Write a program to find factorial of a number using recursive function.
Explain what is the use of a semicolon (;) at the end of every program statement?
What are the scope of static variables?
difference between Low, Middle, High Level languages in c ?
What does s c mean on snapchat?
Write a C program in Fibonacci series.