Program to convert KiloBytes to Bytes and Bits | C ++ implementation of above program ; Function to calculates the bits ; calculates Bits 1 kilobytes ( s ) = 8192 bits ; Function to calculates the bytes ; calculates Bytes 1 KB = 1024 bytes ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; long Bits ( int kilobytes ) { long Bits = 0 ; Bits = kilobytes * 8192 ; return Bits ; } long Bytes ( int kilobytes ) { long Bytes = 0 ; Bytes = kilobytes * 1024 ; return Bytes ; } int main ( ) { int kilobytes = 1 ; cout << kilobytes << " ▁ Kilobytes ▁ = ▁ " << Bytes ( kilobytes ) << " ▁ Bytes ▁ and ▁ " << Bits ( kilobytes ) << " ▁ Bits . " ; return 0 ; }