5cpappu
unknown
plain_text
a year ago
742 B
1
Indexable
Never
#include<stdio.h> main() { int i,n,sum,wt,tat,twt,ttat; int t[10]; float awt,atat; printf("Enter number of processors:\n"); scanf("%d,&n"); for(i=0;i<n;i++) { printf("\n Enter the Burst time of the process %d",i+1); scanf("\n%d",&t[i]); } printf("\n\nFIRST COME FIRST SERVE SHEDULING ALGORITHAM\n"); printf("\n process ID \t Waiting time \t Turn around Time\n"); printf("1\t\t0 \t\t %d\n",t[0]); sum=0; twt=0; ttat=t[0]; for(i=1;i<n;i++) { sum+=t[i-1]; wt=sum; tat=sum+t[i]; twt=twt+wt; ttat=ttat+tat; printf("\n %d \t\t %d \t\t %d",i+1,wt,tat); printf("\n\n"); } awt=(float)twt; atat=(float)ttat; printf("\n Average Waiting Time %4.2f",awt); printf("\nAvefrage turn around time %4.2f",atat); }