fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,i,j,b[20],sb[20],t[20],x,c[20][20];
  5. printf("Enter no.of files:");
  6. scanf("%d",&n);
  7. for(i=0;i<n;i++)
  8. {
  9. printf("Enter no. of blocks occupied by file%d",i+1);
  10. scanf("%d",&b[i]);
  11. printf("Enter the starting block of file%d",i+1);
  12. scanf("%d",&sb[i]);
  13. t[i]=sb[i];
  14. for(j=0;j<b[i];j++) {
  15. c[i][j]=sb[i]++;
  16.  
  17. printf("%d",c[i][j]);}
  18. }
  19. printf("Filename\tStart block\tlength\n");
  20. for(i=0;i<n;i++)
  21. printf("%d\t %d \t%d\n",i+1,t[i],b[i]);
  22. }
Success #stdin #stdout 0s 5276KB
stdin
2
stdout
Enter no.of files:Enter no. of blocks occupied by file1Enter the starting block of file1Enter no. of blocks occupied by file2Enter the starting block of file2Filename	Start block	length
1	 -983668032 	0
2	 5446 	0