C progrma for First Come First Serve Algorithm
#include<stdio.h> #include<math.h> #include<conio.h> void main() { clrscr(); int p[20],b[20],w[20],t[20],i,v,n,at; int wt=0; float tw,tr; printf("Enter the number of process : "); scanf("%d",&n); printf("enter CPU burst time : "); for(i=1;i<=n;i++) { scanf("%d",&b[i]); t[1]=b[1]; w[1]=0; at=t[1]; wt=w[1]; for(i=2;i<=n;i++) { t[i]=b[i]+t[i-1]; at=at+t[i]; w[i]=t[i-1]; wt=wt+w[i]; } } printf("process \t burst_time \t wait_time \t turn_around \t \n"); for(i=1;i<=n;i++) { printf("%d \t\t %d \t\t %d \t\t %d",i,b[i],w[i],t[i]); printf("\n"); } printf("\n average wait time"); tw=wt/n; printf("%f",tw); printf("\n Average turn around time"); tr=at/n; printf("%f",tr); getch(); }
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
September 2nd, 2010 at 10:15 am
I can not compile… there is some C program in specific. to compile.
tks..
July 28th, 2011 at 5:53 pm
hey i wanted the same program using structures in c program… thank u for the basic prog
August 8th, 2011 at 2:26 pm
thanxxxxxxxxxxxxxxxxxxxx
for this
programmmmmmm
dili shukriya
December 17th, 2011 at 12:59 am
not workin !!!!
January 31st, 2012 at 10:34 am
dont upload the error program…….