#include<stdio.h> #include<stdlib.h> int main() { int r[100],i,n,Tst=0,initial; printf("Enter the number of Requests\n"); scanf("%d",&n); printf("Enter the Requests sequence\n"); for(i=0;i<n;i++) scanf("%d",&r[i]); printf("Enter initial head position\n"); scanf("%d",&initial); // logic for FCFS disk scheduling for(i=0;i<n;i++) { Tst=Tst+abs(r[i]-initial); initial=r[i]; } printf("Total head moment / Total Seek time is %d",Tst); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter