New Member FAQ | Forums | Earn Revenue | Distance Education | Help Topics | Admissions 2013
Awards & Gifts
 
Login Login    Register      

ArticlesPractice TestsAsk ExpertsQuestion PapersJobsUniversitiesCollegesCoursesSchools

Active Members
TodayLast 7 Daysmore...

Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Articles/Knowledge Sharing » Education

FIRST COME FIRST SERVE program in C


Posted Date:     Category: Education    
Author: Member Level: Silver    Points: 2


This is the implementation of fcfs (first come first serve) algorithm in C language.



 

#include
#include
void main( )
{
char pname[10][20];
float b_time[10],wt_time[10],avg_time[10],s,t_time[10],k, t=0;
int i,n;
clrscr( );
printf("enter the total no. of processes: ");
scanf("%d",&n);
for(i=0;i {
printf("\nenter process name:");
scanf("%s",pname[i]);
printf("enter burst time ");
scanf("%f",&b_time[i]);
}
for(i=0;i {
if(i==0)
{
wt_time[i]=0;avg_time[i]=0;
}
else
{
wt_time[i]=wt_time[i-1]+b_time[i-1];
}
t_time[i]=wt_time[i]+b_time[i];
t+=t_time[i];
}
k=t/n;
for(i=1;i {
avg_time[i]=avg_time[i-1]+wt_time[i];
}
s=avg_time[n-1]/n;
printf("\n pr.no\t pr.name\t b_time\t wt_time\tt_time\n");
for(i=0;i {
printf("%d\t\t%s\t%f\t%f\t%f\n",i+1,pname[i],b_time[i],wt_time[i],t_time[i]);
}
printf("average waiting time:%f\naverage turn around time: %f\n",s,k);
getch( );
}
Related Resources:


Read related articles: C++ Programs    JAVA programs    


Did you like this resource? Share it with your friends and show your love!





Responses to "FIRST COME FIRST SERVE program in C"
Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: History
    Previous Resource: Presidents of India
    Return to Resources
    Post New Resource
    Category: Education


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Fcfs program in C  .  

    Subscribe to Email
  • Get Jobs by Email
  • Forum posts by Email
  • Articles by Email
  • Online MembersSubodh kant Dubey
    HIROK KANGSHA BANIK
    nooor
    Sun
    Chaitali Ray Chaudhuri (Datta)
    Nityananda Hazarika
    Venkiteswaran.
    Tony John
    raja
    Santhosh Kumar B.V
    More...


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    AdSense Revenue Sharing sites   Advertise   Talk to Tony John
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.