Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is main () in c?

1033


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)

1070


Where are local variables stored in c?

1003


a value that does not change during program execution a) variabe b) argument c) parameter d) none

1212


What is the difference between single charater constant and string constant?

1058


Explain what are the advantages and disadvantages of a heap?

1054


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

1131


Why we not create function inside function.

2156


Explain the difference between strcpy() and memcpy() function?

961


Should I learn c before c++?

1192


What are the primitive data types in c?

1033


What is the difference between the = symbol and == symbol?

1073


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1947


What is the use of the function in c?

989


What is the acronym for ansi?

1016