-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjobsequ.c
More file actions
69 lines (60 loc) · 1.04 KB
/
jobsequ.c
File metadata and controls
69 lines (60 loc) · 1.04 KB
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
#include<stdio.h>
int a[3][2];
int d[10];
int s[3];
int main()
{
int i,j,dead,d1,d2,k;
printf("enter the jobs\n");
for(i=1;i<=3;i++)
{
for(j=1;j<=2;j++)
{
scanf("%d",&a[i][j]);
printf("%d \n",a[i][j]);
}
}
for(i=0;i<10;i++)
{
d[i]=1;
}
for(i=1;i<=3;i++)
{
printf("\n\n\n");
dead=a[i][2];
d1=dead-1;
d2=dead;
printf("%d%d",d1,d2);
if((d[d1]==0)&&(d[d2]==0))
{
printf("not allocated\n");
}
else
{
printf("allocated %d\n",a[i][1]);
s[i]=a[i][1];
d[d1]=0;
d[d2]=0;
}
printf("after %d iteration",i);
for(j=0;j<10;j++)
{
printf("%d",d[j]);
}
printf("\n");
printf("the 2d matrix is\n");
for(k=1;k<=3;k++)
{
for(j=1;j<=2;j++)
{
printf("%d ",a[k][j]);
}
}
}
printf("the final nas is\n");
for(i=1;i<=3;i++)
{
printf("%d\n",s[i]);
}
return 0;
}