hemant kumari

mail@pastecode.io avatar
unknown
plain_text
20 days ago
656 B
3
Indexable
Never
#include <stdio.h>

int main() { int bt[20], wt[20], tat[20], i, n; float wtavg, tatavg; printf("\n enter the
number of process--"); scanf("%d", &n); for (i = 0; i < n; i++)
{printf("\n enter burst time for process %d--", i);
scanf("%d", &bt[i]);
}
wt[0]=wtavg=0;
tat[0]=tatavg=bt[0];
for(i=1;i<n;i++)
{
wt[i]=wt[i-j] +bt[i-1];
tat[i]=tat[i-1] +bt[i];
wtavg=wtavg + wt[i];
tatavg=tatavg +tat[i]
}
printf("\t \tBRUST TIME \t WAITING TIME\t TURNAROUND TIME\n");
for(i=0;i<n;i++)
printf("\n\t p%d \t\t %d", i,bt[i],wt[i],tat[i]);
printf("\n Average waiting time-- %f", wtavg/n);
printf("\n average turnaround time--%f", tatavg/n);
}


Leave a Comment