-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathotherprograms.c
More file actions
60 lines (50 loc) · 812 Bytes
/
otherprograms.c
File metadata and controls
60 lines (50 loc) · 812 Bytes
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
//using getch and putch
#include <stdio.h>
int main()
{
int c;
while((c=getchar())!=EOF)
putchar(c);
return 0;
}
//verifying EOF
#include<stdio.h>
int main()
{
int c,eof='\n';
while (c = getchar() != eof)
{
printf("%d\t", c != eof);
putchar(c);
}
printf("\n%d\n", c != eof);
}
//counting blanks and lines
#include <stdio.h>
int main()
{
int nc=0,c,b=0,nl=0,eof='\n';
while((c=getchar())!=eof)
{
++nc;
if(c=='\n')
++nl;
if(c==' ')
++b;
}
printf("no of blanks:%d\nno of newlines:%d\nno of char:%d",b,t,nl,nc);
return 0;
}
//replacing two or more blanks with single blank
#include<stdio.h>
main()
{
int c=0;
int lastc=0;
while((c=getchar())!=EOF)
{
if(c!=' ')
putchar(c);
if(c==' ')
if(lastc!=' ')
putchar(c);