-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathC program for this
60 lines (51 loc) · 1.24 KB
/
C program for this
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
#include <stdio.h>
#include <stdlib.h>
int main()
{ //reading a file and entering the elements into a array
scanf("%s",fname);
fptr = fopen(fname, "r");
while(fgets(line[i], LSIZ, fptr))
{
line[i][strlen(line[i]) - 1] = '\0';
i++;
}
tot = i;
printf("\n The content of the file %s are : \n",fname);
for(i = 0; i < tot; ++i)
{
printf(" %s\n", line[i]); //needs modification
}
//Creating a array and storing the values into it
int i,j,n=3;
int arr[3][n];
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)
{
int m;
scanf("%d",&m);
arr[i][j]=m;
}
}
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)
{
printf("%d \t",arr[i][j]);
}printf("\n");
}
//Getting the data to compare
int a,b;
printf("Enter the Symptom code and Condition code");
scanf("%d %d",&a,&b);
//Calculating the occurances
int flag=0;
for(i=0;i<n;i++)
{
if(arr[i][0]==a && arr[i][1]==b)
{flag+=1;}
}
printf("%d",flag);
return 0;
}
//accessigntheindexoftheoccuringpattern