0% found this document useful (0 votes)
2 views2 pages

C Program for Process Scheduling Times

The document contains a C program that calculates the waiting time and turnaround time for a set of processes based on their burst times. It prompts the user to enter the number of processes and their respective burst times, then computes and displays the waiting and turnaround times along with their averages. The program outputs the results in a formatted table.

Uploaded by

bhoomika
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

C Program for Process Scheduling Times

The document contains a C program that calculates the waiting time and turnaround time for a set of processes based on their burst times. It prompts the user to enter the number of processes and their respective burst times, then computes and displays the waiting and turnaround times along with their averages. The program outputs the results in a formatted table.

Uploaded by

bhoomika
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include<stdio.

h>

int main ( )

int bt[20], wt[20], tat[20], i, n;

float wtavg, tatavg;

printf("\nenter the number of process:");

scanf("%d",&n);

for(i=0;i<n;i++)

printf("\nenter the brust 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-1]+bt[i-1];

tat[i]=tat[i-1]+bt[i];

wtavg=wtavg+wt[i];

tatavg=tatavg+tat[i];

printf("\tprocess\tbrust time\twaiting time\tturn around time\n");

for(i=0;i<n;i++)

printf("\n\tp%d\t\t%d\t\t%d\t\t%d",i,bt[i],wt[i],tat[i]);

printf("\naverage waiting time: %f",wtavg/n);

printf("\navergae turnaround time: %f",tatavg/n);

return 0;

You might also like