You are on page 1of 1

Array Sample Question 2:

An IP address is defined as a numerical address separated by a full stop and which is used to define
a particular device on the network. Generally, size of the IP address is 4 bytes. It is represented in
the form of dotted decimal notation, where each byte of the IP is separated by a period(.) and value
of each byte is in the range of 0 to 255(both inclusive).

Syntax of writing an IP: (1st byte . 2nd byte . 3rd byte . 4th byte) and each byte is in the range of 0 to
255.

For example: 10.1.9.221 is the IP Address of BITS Library.

Now, each of such IP Addresses can be divided into 5 classes, named A,B,C,D and E. The
conditions for each of the classes is as follows:

A company has n IP addresses, each of which is represented by an array of size 4, where each
element represents one byte of the address.

For example: The BITS Library address will be stored as:


IP = {10,1,9,221}

So for each of the n IP addresses, write a C program that determines the class of the n IP addresses.

You might also like