provive the linux c output screenshot for the code below: #include int main(){ int n, at[10], bt[10], wt[10], ct[10], p[100], t=0, temp, small,k; float att=0.0, awt=0.0 ; printf("enter no.of processes: "); scanf("%d",&n); for(int i=0;iat[j]){       temp=at[i];       at[i]=at[j];       at[j]=temp;       temp=bt[i];       bt[i]=bt[j];       bt[j]=temp;     } } } for(int i=0;i %d turnaround time==>%d waiting time==>%d\n", i+1,ct[i]+1,(ct[i]-at[i])+1, (((ct[i]+1)-wt[i])-at[i])); awt=awt+(((ct[i]+1)-wt[i])-at[i]); att=att+((ct[i]-at[i]+1); } printf("\n awt==>\t%f\n att==>\t%f\n", (awt/n),(att/n)); return 0; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

provive the linux c output screenshot for the code below:

#include<stdio.h>

int main(){

int n, at[10], bt[10], wt[10], ct[10], p[100], t=0, temp, small,k;

float att=0.0, awt=0.0 ;

printf("enter no.of processes: ");

scanf("%d",&n);

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

printf("enter arrival time of process %d:\t",i);

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

wt[i]=0;

t+=bt[i];

}

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

for(int j=i+1;j<n;j++){

  if(at[i]>at[j]){

      temp=at[i];

      at[i]=at[j];

      at[j]=temp;

      temp=bt[i];

      bt[i]=bt[j];

      bt[j]=temp;

    }

}

}

for(int i=0;i<t;i++){

small=25000;

for(int j=0;j<n;j++)

{

if((bt[j] != 0) && (at[j]<=i) && (bt[j]<small))

{

small=bt[j];

k=j;

}

}

bt[k]--;

p[i]=k;

}

k=0;

for(int i=0;i<total;i++){

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

{

if(p[i]==j)

{

ct[j]=i;

wt[j]++;

}

}

}

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

printf("\n process %d:-finish time==> %d turnaround time==>%d waiting time==>%d\n", i+1,ct[i]+1,(ct[i]-at[i])+1, (((ct[i]+1)-wt[i])-at[i]));

awt=awt+(((ct[i]+1)-wt[i])-at[i]);

att=att+((ct[i]-at[i]+1);

}

printf("\n awt==>\t%f\n att==>\t%f\n", (awt/n),(att/n));

return 0;

}

Expert Solution
Step 1

Introduction:

Given Code have some basic errors after resolving those error.

Correct Source Code and Output Screenshot is shown other Steps-

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education