Pages

Page 1

Computer storage and memory is often measured in megabytes (MB) and gigabytes (GB). Z medium-sized novel contains about 1MB of information. 1MB is 1,024 kilobytes, or 1,048,576 (1024x1024) bytes, not one million bytes.

Similarly, one 1GB is 1,024MB or 1,073,741,824 (1024x1024x1024) bytes. A terabyte (TB) is 1024GB; 1TB is about the same amount of information as all of the books ina large library, roughly 1,610 CDs worth of data. A petabyte (PB) is 1,024TB. Indiana University is now building storage systems capable of holding petabytes of data. An exabyte (EB) is 1,024 TB. A zettabnyte (ZB) is 1,024 Eb. Finally, a yottabyte (YB) is 1,024 ZB. Construct the flowchart and code the C program that would accept hard disk capacity in yottabyte and then display its equivalent zettabyte (ZB), exabyte (EB), petabyte (PB), terabyte(TB), gigabyte (GB), megabyte(MB), and kilobyte(XB). Use the conversion factors given in the problem.


C PROGRAM



#include<stdio.h>
#include<conio.h>
#include<math.h>

int main(void)
{
    int YB;
    float ZB,EB,PB,TB,GB,MB,XB;

    clrscr();
    printf("\n\t\tEnter hard disk capacity in YottaByte: ");
    scanf("%d",&YB);

    ZB =YB*pow(1024,1);
    EB =YB*pow(1024,2);
    PB =YB*pow(1024,3);
    TB =YB*pow(1024,4);
    GB =YB*pow(1024,5);
    MB =YB*pow(1024,6);
    XB =YB*pow(1024,7);

    printf("\n\t\t%d YB = %.1f ZB(ZettaByte)",YB,ZB);
    printf("\n\t\t%d YB = %.1f EB(ExaByte)",YB,EB);
    printf("\n\t\t%d YB = %.1f PB(PetaByte)",YB,PB);
    printf("\n\t\t%d YB = %.1f TB(TeraByte)",YB,TB);
    printf("\n\t\t%d YB = %.1f GB(GigaByte)",YB,GB);
    printf("\n\t\t%d YB = %.1f MB(MegaByte)",YB,MB);
    printf("\n\t\t%d YB = %.1f XB(KiloByte)",YB,XB);
    getch();
}