C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Beginners Lab Assignments sample source codes
Program to copy its input to its output replacing string of one
Program to copy its input to its output replacing string of one or more blanks by a single blank #include <stdio.h> #include <conio.h> void main() { char c; clrscr(); printf(" Enter a line of text:- "); printf(" String will be terminated if you press ENTER."); printf(" Press Ctrl-Z & then ENTER to end the task."); printf(" STRING:- "); c=getchar(); printf(" Justified form:- "); while (c!=EOF) { if (c==' ') putchar(c); while (c==' ') { c=getchar(); } putchar(c); c=getchar(); } getch(); }
Privacy Policy
|
Link to Us
|
Links