From c103391974e7670353fd1f3e1affc18e4699f8b4 Mon Sep 17 00:00:00 2001 From: P J Joseph <92437166+pjjoseph10@users.noreply.github.com> Date: Sun, 22 Oct 2023 11:35:22 +0530 Subject: [PATCH] Create Bankers_Algorithm.c I have added a new algorithm called Banker's Algorithm into the repo. --- Bankers_Algorithm.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Bankers_Algorithm.c diff --git a/Bankers_Algorithm.c b/Bankers_Algorithm.c new file mode 100644 index 00000000..c8b95677 --- /dev/null +++ b/Bankers_Algorithm.c @@ -0,0 +1,70 @@ +//C program for Bankers Algorithm + +#include +#include +void main(){ + int n,m,i,j,k; + printf("Process\n"); + scanf("%d",&n); + printf("Resource\n"); + scanf("%d",&m); + int alloc[n][m],max[n][m], avail[m]; + printf("Allo\n"); + for(i=0;iavail[j]){ + flag=1; + break; + } + } + if(flag==0){ + ans[index++]=i; + for(y=0;y",ans[i]); + printf("P%d\n",ans[n-1]); + } +}