New Member FAQ
|
Forums
|
Earn Revenue
|
Distance Education
|
Help Topics
|
Admissions 2013
Awards & Gifts
Login
Register
Articles
Practice Tests
Ask Experts
Question Papers
Jobs
Universities
Colleges
Courses
Schools
Gift Shop
|
Bookmarks
|
Reviews
|
Learn English
|
Social Hub
|
Training
|
New Posts
|
My India
|
Members
|
Polls
|
Active Members
Today
Brijendra Kumar...
(105)
R Pramod
(101)
Venkiteswaran.
(80)
Last 7 Days
R Pramod
(897)
K Mohan
(732)
yash
(640)
more...
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:
30-Mar-2010
Category:
Education
Author:
Priya
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:
C program to solve numericals related to magnetic current
C++ Program to find out the largest number in the given array
Program Efficiency
C++ Programs
C++ Tokens
Inheritance in c++
C++ programs(1)
C++ Program(2)
C++ program(3)
C++ Program to Generate Fibonacci Using Copy Constructor
Read related articles:
C++ Programs
JAVA programs
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "FIRST COME FIRST SERVE program in C"
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
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
History
Mca colleges in delhi
Biofuels
Secretarial work involved in the Issue of Debentures
Developments in Corporate Debt Financing
Redemption of Debentures
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 Members
Subodh 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.