No of visitors who read this post: 440
Category: C
Type: Question
Author: M Sajid
Your rating: None Average: 1 (1 vote)

Following is the memory dump of Drive Parameter Block that is retrieved using undocumented service 32 of Int 21h. Following DPB (Drive Parameter Block) gives information about the logical drive which has FAT16 File system. 

After reading the above dump of DPB (Drive Parameter Block), fill in the following table with required values.

Detail of DPB dump

Of FAT16 Volume

Value In Hexadecimal

Value In decimal

Logical Drive Letter.

Unit No.

Bytes per Sector.

Highest Sector No. within a cluster.

Sector Per Cluster

Shift count.

Reserved sectors.

Number of Fats

Root Directory Entries

First Sector Containing user Data

Highest Cluster Number

No of sectors per FAT

Sector number of First Directory

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#

C PROGRAM

 
/*A summation program*/
 
 
#include <stdio.h>
#include <conio.h>
 
int menu(){
char ch;
clrscr();
 
printf("A.Summation of all numbers from 1 to n\n");
printf("B.Summation of all the squares of the numbers from 1 to n\n");
printf("C.Summation of all even numbers from 1 to n\n");
printf("D.Summation of all odd numbers from 1 to n\n");
printf("E.Exit the program\n\n");
printf("Enter the letter of your choice: ");
scanf(" %c", &ch);
return ch;
}
 
int Summationofnumbers(int n){
int sum, i;
sum=0;
for(i=0; i<=n; i++){
sum=sum+i;
}
return sum;
}
 
int Summationofsquares(int n){
int product=0, i;
for(i=0; i<=n; i++){
product=(i*i)+product;
}
return product;
}
 
int Summationofeven(int n){
int even=0, i, rem;
for(i=0; i<=n; i++){
rem=i%2;
if (rem==0)
even=even+i;
}
return even;
}
 
int Summationofodd(int n){
int odd=0, i, rem;
for(i=0; i<=n; i++){
rem=i%2;
if (rem!=0)
odd=odd+1;
}
return odd;
}
 
int input(void){
int n;
printf("\nEnter a number: ");
scanf("%d", &n);
return n;
}
 
main()
{
int ch, n, sum, square, even, odd;
ch=menu();
switch(ch){
case 'A':
case 'a': n=input();
sum=Summationofnumbers(n);
printf("The summation of all numbers from 1 to %d is %d.", n, Summationofnumbers);
break;
 
case 'B':
case 'b': n=input();
square=Summationofsquares(n);
printf("The summation of all the squares of the numbers from 1 to %d is %d.", n, Summationofsquares);
break;
 
case 'C':
case 'c': n=input();
even=Summationofeven(n);
printf("The summation of all even numbers from 1 to %d is %d.", n, Summationofeven);
break;
 
case 'D':
case 'd': n=input();
odd=Summationofodd(n);
printf("The summation of all odd numbers from 1 to %d is %d.", n, Summationofodd);
break;
 
case 'E':
case 'e': printf("\n\nGoodbye! Press any key to continue...");
break;
 
default: printf("\nWrong Choice!\n");
printf("\nEnter only A, B, C, D or E");
break;
}
getch();
}