#include
int main()
{
int i,n,q,j;
printf("Enter the no. of process you want:-");
scanf("%d",&n);
int b[n];
for(i=1;i<=n;i++)
{
printf("\nEnter burst time for p%d=",i);
scanf("%d",&b[i]);
}
printf("\n\nEnter the Quantum time=");
scanf("%d",&q);
printf("\nYOU ENTER AS FOLLOW:\n");
printf("\nProcess\tBurst time");
for(i=1;i<=n;i++)
{
printf("\np%d\t %d",i,b[i]);
}
printf("\nQuantum time=%d\n\n",q);
for(i=n;i>=1;i--)
{
while(b[i]>0)
{
for(j=1;j<=n;j++)
{
if((b[j]>q)&&(b[j]!=0))
{
b[j]=b[j]-q;
printf("\n process %d excuting and %d sec remaining",i,b[j]);
}
else
{
printf("\n process %d excuted completely",i);
b[j]=0;
}
}
printf("\n");
}
}
}
Copyright © 2011 - All Rights Reserved - Softron.in
Template by Softron Technology