Practical 9 by Paxton

 #include<stdio.h>

int main()

{

    int i,j,n;

    int ot[25],od[25],add[25],k,o[25]={0};

    printf("Enter the no or orders:");

    scanf("%d",&n);

    printf("Enter the order Details:\n");

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

    {

        printf("Order time:");

        scanf("%d",&ot[i]);

        printf("Order Duration:");

        scanf("%d",&od[i]);

        add[i]=ot[i]+od[i];

        k=add[i]%n;

       //printf("%d\n",k);

       while(1)

       {


            if(o[k]==0)

            {

                o[k]=i+1;

                //printf("%d\n",k);

                break;

            }

            else

                k=(k+1)%5;

        }

    }

    printf("Sequence of Order: should be placed:\n");

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

    {

        printf("%d\n",o[i]);

    }

}

Comments

Popular posts from this blog

DAA P4 bfs, dfs

DAA P8 graph coloring

Practical 8 by Karan