online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<stdio.h> void main() { int n, at[20], bt[20], wt[20], tat[20],i,j; float avgwt=0, avgtat=0; //Reading number of processes printf("Enter the number of processes: "); scanf("%d",&n); //Reading each process details printf("Assuming Arrival time is 0 for all processes.\n"); for(i=0;i<n;i++) { printf("Process number %d \n", i); at[i]=0; printf("Burst Time:"); scanf("%d",&bt[i]); printf("\n"); } wt[0]=0; //first process does not have to wait. //Finding Waiting Time of each process for(i=1;i<n;i++) { wt[i]=0; for(j=0;j<i;j++) { wt[i] = wt[i] + bt[j]; } } //Finding TurnaroundTime for(i=0;i<n;i++) { tat[i]=wt[i]+bt[i]; //TAT = WT + BT } //Finding Average Waiting Time for(i=0;i<n;i++) { avgwt = avgwt + wt[i]; } avgwt = avgwt/n; //Finding Average TurnAround Time for(i=0;i<n;i++) { avgtat = avgtat + tat[i]; } avgtat = avgtat/n; //Displaying The Table printf("The Table is:\n\n"); printf("PID\tAT\tBT\tWT\tTAT\n"); for(i=0;i<n;i++) { printf("%d\t%d\t%d\t%d\t%d\n", i, at[i], bt[i], wt[i],tat[i]); } //Displaying Average TAT and WT printf("\nAverage Waiting Time = %f \n",avgwt); printf("Average TurnAround Time = %f \n", avgtat); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



Program is not being debugged. Click "Debug" button to start program in debug mode.