dharmil007
Journeyman
Small error in C implementing fCfS algo
I m trying to implement fCfS Algo.
The programm is not ful fledged complete.
But the programm ends abruptly after the first input
So pls can anyone help me whats wrong ?
I m trying to implement fCfS Algo.
The programm is not ful fledged complete.
But the programm ends abruptly after the first input
So pls can anyone help me whats wrong ?
PHP:
#include <stdio.h>
int nopr,art[50],jt[50],start,wt[50],i,j,k,l,m;
void fcfs ()
{
//int i,j,k,l,art[50],jt[50],start,wt[50];
printf ("\n Enter arrival Time in ascending order\n");
for (i=0;i<=nopr;i++)
{
scanf ("%d", art[i]);
}
printf ("\n Enter job Time\n");
for (j=0;j<=nopr;j++)
{
scanf ("%d", jt[j]);
}
for (k=1;k<=nopr;k++)
{
start=art[i]+jt[j];
wt[l]=start-art[i];
}
printf ("fCfS Algo");
printf ("The waiting Time for each process is :\n");
for (m=0;m<=nopr;m++)
{
printf ("%d",wt[l]);
}
}
int main ()
{
//int nopr,art[50],jt[50],start,wt[50],i,j,k,l;
printf ("\n\n------------- Scheduling Algorithm fCfS -------------\n\n");
printf ("Enter no of process \n");
scanf ("%d\n",&nopr);
fcfs ();
return 0;
}
Last edited by a moderator: