OUTPUT:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1
p_name P_time w_time
aaa 4 0
bbb 3 4
ccc 2 7
ddd 5 9
eee 1 14
total waiting time=34
avg waiting time=6.80
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include<stdio.h> #include<conio.h> #include<process.h> void main() { char p[10][5]; int tot=0,wt[10],i,n; float avg=0; clrscr(); printf("enter no of processes:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter process%d name:\n",i+1); scanf("%s",&p[i]); printf("enter process time"); scanf("%d",&pt[i]); } wt[0]=0; for(i=1;i<n;i++) { wt[i]=wt[i-1]+et[i-1]; tot=tot+wt[i]; } avg=(float)tot/n; printf("p_name\t P_time\t w_time\n"); for(i=0;i<n;i++) printf("%s\t%d\t%d\n",p[i],et[i],wt[i]); printf("total waiting time=%d\n avg waiting time=%f",tot,avg); getch(); } |
OUTPUT:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1
p_name P_time w_time
aaa 4 0
bbb 3 4
ccc 2 7
ddd 5 9
eee 1 14
total waiting time=34
avg waiting time=6.80













the code is wrong because
” et ” is not declare instead of it replace “et ” to “pt “
the code is wrong because
” et ” is not declare instead of it replace “et ” to “pt “
and
instead of char p[10][10]
write p[10]
……………………………………………….
dis program iz rit bcoz dis is’ pt’=process time not ‘et’
i want fcfs program imediatly in java code
begin
if(fcfs=-1)
print(“java”)
end
tumari ma ka choda mc na mili
midfingzzzzzzzzzzzz
programme C qui convert NTFS vers FAT 32 sans pert de donée & mercu d’avance
pt=et is write becoz when we globle declaired
Why turnaround time will be not found…lakhavu to badhu lakhavu harder…