diff --git a/charcount b/charcount new file mode 100755 index 0000000..3674d42 Binary files /dev/null and b/charcount differ diff --git a/charcount.c b/charcount.c new file mode 100644 index 0000000..a0fb403 --- /dev/null +++ b/charcount.c @@ -0,0 +1,14 @@ +#include +main (){ + int c, nb,nt,nl = 0; + while ((c = getchar()) != EOF) + { + if(c='\0') + ++nb; + if(c='\t') + ++nt; + if(c='\n') + ++nl; + } + printf("\nThere are %d blanks, %d tabs, and %d new lines\n", nb,nt,nl); +} \ No newline at end of file diff --git a/getchar b/getchar new file mode 100755 index 0000000..1f47047 Binary files /dev/null and b/getchar differ diff --git a/getchar.c b/getchar.c new file mode 100644 index 0000000..b8e2b73 --- /dev/null +++ b/getchar.c @@ -0,0 +1,6 @@ +#include +main (){ +int c; +c='\0'; +printf("%d\n",c); +} diff --git a/temperature b/temperature new file mode 100755 index 0000000..0e4fbe7 Binary files /dev/null and b/temperature differ diff --git a/temperature.c b/temperature.c new file mode 100644 index 0000000..cdbc041 --- /dev/null +++ b/temperature.c @@ -0,0 +1,26 @@ +#include +#define UPPER 300 +#define LOWER 0 +#define STEP 20 +main() +{ + float fahr, celsius ; + fahr = LOWER; + printf("%3s\t%6s\n", "Farenheit", "Celsius"); + while (fahr <= UPPER) { + celsius = 5 * (fahr-32) / 9; + printf("%3.0f\t%6.1f\n", fahr, celsius); + fahr = fahr + STEP; + } + fahr, celsius = 0; + celsius = LOWER; + printf("%3s\t%6s\n", "Celsius", "Farenheit"); + while (celsius <= UPPER ) { + fahr = (5.0/9.0) + (celsius + 32.0); + printf("%3.1f\t%6.0f\n", celsius, fahr); + celsius = celsius + STEP; + } + for (fahr = 300; fahr >= 0; fahr -= 20){ + printf("%3.1f %6.1f\n", fahr, (5.0/9.0)*(fahr-32)); + } +} \ No newline at end of file