Skip to content

Commit 069b420

Browse files
committed
converted a program to better.. my life as a programmer
1 parent 5ebb3e9 commit 069b420

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

1_14.c

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
main() {
4+
int character, i;
5+
int character_count[255];
6+
7+
for(i = 0; i <= 255; i++)
8+
character_count[i] = 0;
9+
10+
while((character = getchar()) != EOF)
11+
++character_count[character - '0'];
12+
13+
for(i = 33; i <= 127; i++) {
14+
while(character_count[i] > 0) {
15+
printf("%s", "]");
16+
--character_count[i];
17+
}
18+
printf("%s", "\n");
19+
}
20+
}

1_15.c

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
float farenheit_to_celcius(int fahrenheit);
4+
5+
main()
6+
{
7+
int fahrenheit = 0;
8+
9+
while(fahrenheit <= 300) {
10+
printf("%4d %6.1f %s", fahrenheit, farenheit_to_celcius(fahrenheit), "\n");
11+
fahrenheit = fahrenheit + 20;
12+
}
13+
}
14+
15+
float farenheit_to_celcius(int fahrenheit)
16+
{
17+
float celcius;
18+
celcius = (5.0/9.0) * (fahrenheit - 32.0);
19+
return celcius;
20+
}

0 commit comments

Comments
 (0)