-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnextlevelprograms.c
74 lines (59 loc) · 1 KB
/
nextlevelprograms.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//replacing blanks and tabs with slashes
#include<stdio.h>
int main()
{
int c;
while((c=getchar())!=EOF)
{
if(c=='\t')
printf("\\t");
if(c==' ')
printf("\\b");
if(c=='\\')
printf("\\");
else
putchar(c);
}
}
//printing each word of an input string
#include<stdio.h>
int main() {
int c;
c = getchar();
while (c != EOF) {
if (c == ' ') {
putchar('\n');
}
else {
putchar(c);
}
c = getchar();
}
}
//horizontal histogram
#include<stdio.h>
int main(void)
{
int c;
while((c=getchar())!=EOF)
{
if( c == ' ' || c == '\n' || c == '\t')
putchar('\n');
else
putchar('*');
}
return 0;
}
//temperature conversion using functions
#include <stdio.h>
void temperature()
{
printf("temperature conversion table\n");
float fahrenheit=0;
for(fahrenheit=0;fahrenheit<=300;fahrenheit=fahrenheit+20)
printf("%3.0f %6.1f\n",fahrenheit,(5.0/9.0)*(fahrenheit-32));
}
void main(void)
{
temperature();
}