Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

FCFS

 FCFS-Operating System


#include<iostream>

using namespace std;

int  main()

{

 int n;

 cout<<"Enter process : "<<endl;

 cin>>n;


 int bt[n];

 for(int i=0; i<n; i++){

    cout<<"Enter process "<<i+1<<" : ";

    cin>>bt[i];

 }

 int wt=0;

 int tw=0;

 for( int i=0; i<n; i++){

    cout<<"Waiting Time "<<i+1<<" : "<<wt<<endl;

    wt += bt[i];

    tw +=wt;

 }

 cout<<"Total avg time "<<tw-wt/float(n);

 return 0;

}



Post a Comment

0 Comments