123
123
h>
int main() {
int pr[5]={0,1,2,3,4},at[5]={3,6,0,6,5},bt[5]={5,4,3,2,4};
int Ttat=0,tat[5],Twt=0,wt[5],i,j,t=0,temp;
for(i=0;i<=3;i++){
for(j=i+1;j<=4;j++)
if(at[i]>at[j]){
temp=at[i];
at[i]=at[j];
at[j]=temp;
temp=pr[i];
pr[i]=pr[j];
pr[j]=temp;
temp=bt[i];
bt[i]=bt[j];
bt[j]=temp;
for(i=0;i<=4;i++){
wt[i]=t-(at[i]);
Twt+=wt[i];
t=t+bt[i];
tat[i]=t-at[i];
Ttat+=tat[i];
for(i=0;i<=4;i++)
printf("\n Average waiting time =%f \t Average Turn around Time =%f",Twt/5.0,Ttat/5.0);
return 0;