Priority
Never
#include<stdio.h> struct priority_scheduling { char process; int bt,wt,tat,priority; }; int main() { int no_of_process; int total =0; struct priority_scheduling temp_process; int ASCII_number = 65; int position; float average_waiting_time; float average_turnaround_time; printf("Enter the number of processes:"); scanf("%d",&no_of_process); struct priority_scheduling process[no_of_process]; printf("Please enter the bt and priority of each process\n"); for(int i=0;i<no_of_process;i++) { process[i].process = (char) ASCII_number; printf("Enter the details of the process %c \n",process[i].process); printf("enter the bt :"); scanf("%d",&process[i].bt); printf("enter the priority :"); scanf("%d",&process[i].priority); ASCII_number; } for(int i=0;i<no_of_process;i++) { position = i; for(int j=i+1;j<no_of_process;j++) { if(process[j].priority > process[position].priority) { position = j; } } temp_process = process[i]; process[i] = process[position]; process[position] = temp_process; } process[0].wt = 0; for(int i=0;i<no_of_process;i++) { process[i].wt = 0; for(int j=0;j<i;j++) { process[i].wt += process[j].bt; } total += process[i].wt; } average_waiting_time = (float) total / (float) no_of_process; total =0; printf("\n process name \t BT \t WT \t TAT \n"); for(int i=0;i<no_of_process;i++) { process[i].tat = process[i].bt = process[i].wt; total = process[i].tat; printf("\t %c \t %d \t %d \t %d \n",process[i].process,process[i].bt,process[i].wt,process[i].tat); } average_turnaround_time = (float)total/ (float) no_of_process; printf("Average WT %f\n",average_waiting_time); printf("Average TAT : %f",average_turnaround_time ); return 0; }
Raw Text
-
How To Teach Bio Core Cbd Gummies Better Than Anyone Else
27 min ago
-
Facebook- https://www.facebook.com/ZappifyUSA/
38 min ago
-
Untitled
42 min ago
-
Untitled
43 min ago
-
✅✅ Cheating wife/GF with audio ✅✅
44 min ago
-
FB@>> https://www.facebook.com/ZappifyUSA/
52 min ago
-
Dating with teens
58 min ago
-
The Future of Retail: Adapting to Changing Consumer Preferences
58 min ago
-
EyeFortin Review - Real Side Effects Risk to Worry About? (Official Store)!
1 hour ago
-
Weekend Getaway | Corbett Mystic Inn Resort in Jim Corbett
1 hour ago