Banker 1
Banker 1
h>
int main() {
int p, c, count = 0, i, j, alc[5][3], max[5][3], need[5][3], safe[5], available[3], done[5],terminate = 0;
printf("Enter the number of process and resources");
scanf("%d %d", & p, & c);
printf("Enter allocation of resource of all process %dx%d matrix", p, c);
for (i = 0; i < p; i++) {
for (j = 0; j < c; j++) {
scanf("%d", & alc[i][j]);
}
}
printf("Enter the max resource process required %dx%d matrix", p, c);
for (i = 0; i < p; i++) {
for (j = 0; j < c; j++) {
scanf("%d", & max[i][j]);
}
}
printf("Enter the available resource");
for (i = 0; i < c; i++)
scanf("%d", & available[i]);
OUTPUT
Need resources matrix are
743
122
600
211
531