text: #include<stdio.h>
  struct proc
  {
      int no,at,bt,ct,tat,wt;
  };
  struct proc read(int i)
  {
      struct proc p;
      printf("\nProcess No: %d\n",i);
      p.no=i;
      printf("Enter Arrival Time: ");
      scanf("%d",&p.at);
      printf("Enter Burst Time: ");
      scanf("%d",&p.bt);
      return p;
  }
  int main()
  {
      struct proc p[10],tmp;
      float avgtat=0,avgwt=0;
      int n,ct=0;
      printf("<--FCFS Scheduling Algorithm (Non-Preemptive)-->\n");
      printf("Enter Number of Processes: ");
      scanf("%d",&n);
      for(int i=0;i<n;i++)
          p[i]=read(i+1);
      for(int i=0;i<n-1;i++)
          for(int j=0;j<n-i-1;j++)    
              if(p[j].at>p[j+1].at)
              {
              tmp=p[j];
              p[j]=p[j+1];
              p[j+1]=tmp;
              }
      printf("\nProcessNo\tAT\tBT\tCT\tTAT\tWT\tRT\n");
      for(int i=0;i<n;i++)
      {
          ct+=p[i].bt;
  		p[i].ct=ct;
          p[i].tat=p[i].ct-p[i].at;
          avgtat+=p[i].tat;
          p[i].wt=p[i].tat-p[i].bt;
          avgwt+=p[i].wt;
          printf("P%d\t\t%d\t%d\t%d\t%d\t%d\t%d\n",p[i].no,p[i].at,p[i].bt,p[i].ct,p[i].tat,p[i].wt,p[i].wt);
      }
      avgtat/=n,avgwt/=n;
      printf("\nAverage TurnAroundTime=%f\nAverage WaitingTime=%f",avgtat,avgwt);
  }
  