Preview:
#include<stdio.h>

void WT(int processes[], int n, int bt[], int wt[])
{
	wt[0] = 0;
	
	for (int i = 1; i < n ; i++ )
		wt[i] = bt[i-1] + wt[i-1] ;
}

void TAT( int processes[], int n, int bt[], int wt[], int tat[])
{
	// bt[i] + wt[i]
	for (int i = 0; i < n ; i++)
		tat[i] = bt[i] + wt[i];
}

void AT( int processes[], int n, int bt[])
{
	int wt[n], tat[n], total_wt = 0, total_tat = 0;

	WT(processes, n, bt, wt);

	TAT(processes, n, bt, wt, tat);

	printf("Processes Bursttime Waitingtime Turn-aroundtime\n");

	for (int i=0; i<n; i++)
	{
		total_wt = total_wt + wt[i];
		total_tat = total_tat + tat[i];
		printf(" %d ",(i+1));
		printf("\t\t\t%d ", bt[i] );
		printf("\t\t\t\t%d ", wt[i] );
		printf("\t\t\t%d\n",tat[i] );
	}
	int s=(float)total_wt / (float)n;
	int t=(float)total_tat / (float)n;
	printf("Average waiting time = %d",s);
	printf("\n");
	printf("Average turn around time = %d ",t);
}

int main()
{
	int processes[] = { 1, 2, 3};
	int n = sizeof processes / sizeof processes[0];

	int burst_time[] = {10, 5, 8};

	AT(processes, n, burst_time);
	return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter