First Come First Serve ( FCFS ) in c

On-campus and online computer science courses to Learn the basic concepts of Computer Science.This tutorial will cover c ,c++, java, data structure and algorithm,computer graphics,microprocessor,analysis of algorithms,Digital Logic Design and Analysis,computer architecture,computer networks,operating system.
code in C:
#include <stdio.h>
int main() 
{
 int b[10],temp[10],i,j,avg=0,tt=0; 
 printf("enter burst time:\n");
 for(i=0;i<3;i++)
 scanf("%d",&b[i]); 
 temp[0]=0;
 for(i=0;i<3;i++)
 temp[i+1]=temp[i]+b[i]; 
 for(i=0;i<3;i++)
 avg=avg+temp[i];
 avg=avg/3;
 printf("The Average WT is %d ms\n",avg);  
 for(i=1;i<4;i++)
 tt=tt+temp[i];
 tt=tt/3;
 printf("The Average TT is %d ms\n",tt);
 return 0;
}   
output:-
enter burst time:
24
3
3
The Average WT is 17 ms
The Average TT is 27 ms

--------------------------------

0 comments: