-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path-999.c
49 lines (38 loc) · 764 Bytes
/
-999.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
#include<stdio.h>
void main()
{
int no;
FILE *fp;
int even=0,odd=0;
fp = fopen("e:\\ccc\\out-put\\-999.txt","w+b");
printf("\n enter number press -999 to stop ::");
printf("\n\n enter number ::");
scanf ("%d",&no);
while(no != -999)
{
if(no%2==0)
{
even++;
}
else
{
odd++;
}
printf("\n enter number ::");
putw(no,fp);
scanf("%d",&no);
}
rewind(fp);
/* fclose(fp);
fp = fopen("e:\\ksl.txt","rb+"); */
no=getw(fp);
while(!feof(fp))
{
printf ("\t%d",no);
no = getw(fp);
}
printf("\n odd number is :: %d",odd);
printf("\n even numbe is :: %d",even);
fclose(fp);
scanf ("%d");
}