|
Get 9,000+ Interview Questions with Answers in an eBook
C Source Codes List | Source Code Home
Program : Program to copy its i/p to its o/p replacing string of one or more blanks by a single blank.
/* Prg. to copy its i/p to its o/p replacing string of one or
more blanks by a single blank */
#include
#include
void main()
{
char c;
clrscr();
printf("\nEnter a line of text:- ");
printf("\nString will be terminated if you press ENTER.");
printf("\nPress Ctrl-Z & then ENTER to end the task.");
printf("\nSTRING:-\n ");
c=getchar();
printf("\n\nJustified form:- ");
while (c!=EOF)
{
if (c==' ')
putchar(c);
while (c==' ')
{
c=getchar();
}
putchar(c);
c=getchar();
}
printf("\n\n\n\n\n\t\t\tHAVE A NICE DAY! BYE.");
getch();
}
C Source Codes List | Source Code Home
|
|
|