#include <stdio.h>
#define OUT 0 /* outside word */
#define IN 1 /* inside word */
int main(void)
{
int c, nw;
nw = 0;
while((c = getchar()) != EOF)
{
while ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
;
+...
/* Write a program to copy its input to its output,replacing each tab by \t, *each backspace by \b,and each backslash by \\ .This makes tabs and backspaces *visible in an unambiguous way */ #include <stdio.h> int main(void) { int c; while ((c = getchar()) != EOF) { if...
/*Write a program to copy its input to its output, *replacing each string of one or more blanks by a single blank*/#include <stdio.h>
#define OUT 1 /* outside the word */#define IN 0 /* inside the word */
int main(void){ int c,state; state = OUT; while ((c = getchar()) != EO...
/* Write a program to count blanks,tabs,and newlines */
#include <stdio.h>
int main(void)
{
int c, nb, nt, nn;
nb = nt = nn = 0;
while((c = getchar()) != EOF)
{
if (c == ' ') ++nb;
if (c == '\t') ++nt;
if (c == '\n') ++nn;
}
print...
/* 1st version */
#include <stdio.h>
int main(void)
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d",nl);
getch();
return 0;
}
===========================
/* 2nd version */
#include <stdio.h...
/* 1st version */
#include<stdio.h>
int main(void)
{
int c, nc;
nc = 0;
while((c = getchar()) !=EOF)
{
++nc;
}
printf("%d",nc);
getch();
return 0;
}
======================
/* 2nd version */
#include <stdio.h>
int main(v...
/* Write a program to print the value of EOF */
/* 1st version */
#include <stdio.h>
int main(void){ int c;
c = EOF;
printf("the value of EOF is %d",c);
getch(); return 0;}
===============/* 2nd version */
#include <stdio.h>
int main(void){ printf("...
/* 1st verion.copy input to output */
#include <stdio.h>
int main (void){ int c;
c = getchar(); while (c != EOF) { putchar(c); c = getchar(); }
return 0;}
===========================
/* 2ed version.copy input to output */
#include <stdio.h>
...
/* The version of symbolic constants : print Fahrenheit-celsious table */
#include<stdio.h>
#define LOWER 0#define UPPER 300#define STEP 20
int main(viod){ float fahr;
for (fahr = LOWER; fahr <= UPPER; fahr += STEP ) { printf("%3.0f%6.1f\n", fahr, (5.0/9.0) * ( f...
/* Modify the temperature conversion program to print the table in reverse order, *that is form 300 degrees to 0. */
#include <stdio.h>
int main(void){ float fahr; for(fahr = 300; fahr >= 0; fahr-=20) { printf("%3.0f%6.1f\n",fahr,(5.0/9.0) * (fahr - 32)); } ...
/* the version of for statement;print Fahrenheit - Celsius table */
#include <stdio.h>
int main(void){ float fahr;
for ( fahr = 0; fahr <=300; fahr+=20) { printf("%3.0f%6.1f\n",fahr,(5.0/9.0)*(fahr-32)); } getch(); return 0;}
/* Write a program to print the corresponding Celsius to Fahrenhei table */
#include <stdio.h>
int main(void){ float cels, fahr; int lower, upper, step; lower = 0; upper = 100; step = 10; cels = lower; while ( cels <= upper) { fahr = 9 * cels / 5 + 3...
/* Modify the temperature conversion program to print a heading above the table */
#include <stdio.h>
int main(void){ float fahr, cels; int lower, upper, step; lower = 0 ; upper = 300; step = 20; fahr = lower; printf("F\tC\n"); while (fahr <= upper) { ...
The program uses the formula [ Celsius = (5/9) * (Fahrenheit - 32)] to print the following table of Fahrenheit temperatures and their centigrade or Celsius equivalents:
=============
/* print Fahrenheit - Celsius table for fahr =0, 20, ..., 300 */
#include <stdio.h>
int main(void)
{
...
the program to print "hello, world"
==============
#include <stdio.h>
int main(void)
{
printf("hello, world");
return 0;
}