im just a newbie here..
can someone help me with my program about FCFS scheduling algo,
here the code that i made..
the first 2 process is correct but the succeding process is not.. please help me with the right computation.
note: TAT= Time of completion - Arrival Time;
Expand|Select|Wrap|Line Numbers
- #include<stdio.h>
- #include<conio.h>
- int proc,x,at[10],bt[10],sum;
- main()
- {
- clrscr();
- printf ("Input number of process: ");
- scanf("%d",&proc);
- printf ("\n\nProcess#\t\tArrival Time\t\tBurst Time\tTat");
- for (x=1;x<=proc;x++)
- {
- gotoxy (4,4+x);
- printf("%d",x);
- gotoxy (30,4+x);
- scanf ("%d", &at[x]);
- gotoxy (55,4+x);
- scanf("%d",&bt[x]);
- sum=sum+1+bt[x]-at[x];
- gotoxy (65,4+x);
- printf("%d",sum);
- }
- getch();
- return 0;
- }