mm
#include <stdio.h>
#include <math.h>
int main() {
int logicalAddressBits;
printf("Enter Logical address space Information in bits: ");
scanf("%d", &LogicalAddressBits);
double logicalAddressSize = pow(2, logicalAddressBits);
printf("\nLogical address space size= %.6f\n", logicalAddesssSize);
double physicalMemorySizeMB;
printf("Enter Physical address space Information in MB: ");
scanf("%lf", &physicalMemorySizeMB);
int pageSizeKB;
printf("Enter Page Size Information in KB: ");
scanf("%d", &pageSizeSizeKB);
double totalPages = logicalAddressSize / (pagesSizeKB * 1024);
int bitsForPagesSize = log2(pagesSizeKB * 1024);
int bitsForTotalPages = ceil(log2(totalPages));
int bitsForTotalFrames = ceil(log2(physicalMemorySizeMB * 1024 / pagesSizeKB));
printf("\nCalculated Information:\n");
printf("Number of pages required in the given logical Address Space (p): %.6f\n", totalPages);
printf("Number of bits needed for the page size (d): %.6f\n", (double)bitsForPagesSize);
printf("Number of bits needed for total number of page size (p): %.6f\n", (double)bitsForTotalPages);
printf("Number of bits needed for total number of frames size (f): %.6f\n", (double)bitsForTotalframes);
return 0;
}