Write a Simple Program in C language

Asked By 10 points N/A Posted on -
qa-featured

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

 

 

 

SHARE
Answered By 0 points N/A #124088

Write a Simple Program in C language

qa-featured

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 nn");
printf("B.Summation of all the squares of the numbers from 1 to nn");
printf("C.Summation of all even numbers from 1 to nn");
printf("D.Summation of all odd numbers from 1 to nn");
printf("E.Exit the programnn");
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("nnGoodbye! Press any key to continue…");
break;
 
default: printf("nWrong Choice!n");
printf("nEnter only A, B, C, D or E");
break;
}
getch();
}
 

Related Questions