seq_cec

mail@pastecode.io avatar
unknown
plain_text
5 months ago
674 B
2
Indexable
#include<stdio.h>
#include<stdlib.h>
void main()
{
 int n,i,j,b[20],sb[20],t[20],x,c[20][20];
 printf("Enter no.of files:");
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  printf("Enter no. of blocks occupied by file%d",i+1);
  scanf("%d",&b[i]);
  printf("Enter the starting block of file%d",i+1);
  scanf("%d",&sb[i]);
  t[i]=sb[i];
  for(j=0;j<b[i];j++)
   c[i][j]=sb[i]++;
 }
 printf("Filename\tStart block\tlength\n");
  for(i=0;i<n;i++)
 printf("%d\t\t%d\t\t%d\n",i+1,t[i],b[i]);
 printf("Enter file name:");
 scanf("%d",&x);
 printf("\nFile name is:%d",x);
 printf("\nlength is:%d",b[x-1]);
 printf("\nblocks occupied:");
 for(i=0;i<b[x-1];i++)
  printf("%4d",c[x-1][i]);
} 
Leave a Comment