Computer Science, asked by iamsagar73, 4 months ago

Write a program to convert from one unit to another unit as per the users choice using switch case.

Choice No. conversion

1. KB to bytes

2. Metre to inch

3. Gallon to litre


Hint: 1 KB = 1024 Bytes; 1 Metre = 39.34 inch; 1 Gallon = 20/9 Litres

Answers

Answered by TaheniyatAnjum
0

Explanation:

Program to convert KiloBytes to Bytes and Bits

Given Number of Kilobytes. The task is to Convert them into Bytes and Bits.

Bit: A Bit is the basic unit in computer information and has only two different values, normally defined as a 0 or 1. These values can be interpreted as on or off, yes or no, true or false, etc. It just depends on the binary code.

Add 1 bit, double the number of patterns.

1 bit – 2 patterns i.e 0 and 1

2 bits – 4 patterns i.e 00, 01, 10, 11

3 bits – 8 patterns i.e 000, 001, 010, 011, 100, 101, 110, 111

Mathematically: n bits yields 2n patterns.

Bytes: A Byte is just 8 Bits and is the smallest unit of memory that can be addressed in many computer systems.

Important points about Bytes:

Similar questions