Write a program that computes how many bytes are there in given numbers of kilobytes (KB), megabytes (MB), gigabytes (GB), kibibytes (KiB), mebibytes (MiB) and gibibytes (GiB). Use the decimal scale (1000) for the kilo, mega and giga prefixes and the binary scale (1024) for the kibi, mebi and gibi prefixes.
For each line of input there should be a number n and a unit u
For each line of input there should be a line of output indicating how many bytes correspond to what was given on the input.
Input is given so that the resulting value n' is in the range 0 ≤ n' ≤ 1 073 741 824.
2 KB 2 KiB 12 MB 1 GiB
2000 bytes 2048 bytes 12000000 bytes 1073741824 bytes
try next: bconv
Copyright © 2020-2023 Rudy Matela
All rights reserved