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 “
Output: "We Are Student"

Answer Posted / vadivel t

#include<stdio.h>
main()
{
char *p, *q, *q1;
p = (char *)malloc(200);
q = (char *)malloc(200);
q1 = q;
printf("ENTER THE SENTENCE: \n");
p = gets(p);
while(*p != '\0')
{
if(*p != ' ' || *(q -1) != ' ')
{
*q++ = *p++;
}
else
p++;
}
*q = '\0';
printf("%s", q1);
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which header file should you include if you are to develop a function which can accept variable number of arguments?

1374


diff between exptected result and requirement?

2040


What is a const pointer in c?

1119


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1076


Is it better to use malloc() or calloc()?

1094


What is binary tree in c?

1084


What does c in a circle mean?

1057


How to implement a packet in C

2871


What is exit() function?

1001


What are the complete rules for header file searching?

1067


Without Computer networks, Computers will be half the use. Comment.

2288


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

1221


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

3329


What is c system32 taskhostw exe?

1011


Are global variables static in c?

1148