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 huge pointer in c?
What is this infamous null pointer, anyway?
What is I ++ in c programming?
Which built-in library function can be used to match a patter from the string?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
Why is struct padding needed?
What is a stream?
Mention four important string handling functions in c languages .
What is p in text message?
what is the function of pragma directive in c?
What will be the outcome of the following conditional statement if the value of variable s is 10?
What is local and global variable in c?
What does it mean when a pointer is used in an if statement?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.