You are on page 1of 2

#include <stdio.

h>
void main()
{
int i, n=6, location;
int a[10], t[10], b[10], c[10];
int minimum;
for(i=1; i<=n; i++)
{
printf("\nEnter the time for Job %d for Stage 1 ", i);
scanf("%d", &a[i]);
}
for(i=1; i<=n; i++)
{
printf("\n%d", a[i]);
}
minimum = a[1];
for ( i = 1 ; i <=5 ; i++ )
{
if ( a[i] <= minimum )
{
minimum = a[i];
location = i;
}
}
printf("\nMinimum = %d", minimum);
printf("\nLocation = %d", location);
/* for 5 machines*/
for ( i = 1 ; i <=5 ; i++ )
{
if(i==location)
{
t[i] = a[location] + a[n];
}
else
{
t[i] = a[i];
}
printf("\n%d", t[i]);
}
/* For II stage 6 machines*/
for(i=1; i<=n; i++)
{
printf("\nEnter the time for Job %d for Stage 2 ", i);
scanf("%d", &b[i]);
}
for(i=1; i<=n; i++)
{
if(i==n)
{
b[i] = t[location] + b[n];
}
else
{
b[i] = b[i] + a[i];
}
printf("\n%d", b[i]);
}

/*for stage III 4 machines*/
for(i=1; i<=n; i++)
{
printf("\nEnter the time for Job %d for Stage 3 ", i);
scanf("%d", &c[i]);
}

for(i=1; i<=n; i++)
{
printf("\n%d", c[i]);
}

for(i=1; i<=n; i++)
{
c[i] = c[i] + b[i];
printf("\n%d", c[i]);
}
getchar();
}

You might also like