top of page

Problem 3

Identify machines in same local network (Id-1053)

 

Question:         

Numeric addresses for computers on the international network, 'Internet' has four parts, separated by periods, of the form   xxx.yyy.zzz.mmm    where  xxx ,  yyy ,  zzz , and  mmm  are positive integers. Locally, computers are usually known by a nickname as well.

Sample Data 

IP address       Name

111.22.3.44        platte 

555.66.7.88        wabash 

111.22.5.66        green 

0.0.0.0                none

A pair of computers are said to be in same locality when the first two components of the addresses are same. Given the details of some computers, design an algorithm and write a C program to display a list of messages identifying each pair of computers from the same locality. In the messages, the computers should be identified by their nicknames. In this example, the message to be displayed will be Machines platte and green are on the same local network. For example, given IP address and nick name of machines as follows:

101.33.2.1              Atlas
101.33.56.80          Horizon
101.43.45.74          Pluto

Print 'Machines Atlas and Horizon are on the same local network'.

Input Format:

Number of computers 'n'

IP address of the computer1 as a String

Nick names of the computer1 as a String

IP address of the computer2 as a String

Nick names of the computer2 as a String

....

IP address of the computer n as a String

Nick names of the computer n as a String

Output Format:

For each pair of machines in the same local network, print:

Machines A and B are on the same local network (A and B are names of the respective machines)

OUTPUT
INPUT
PROCESSING

I'm a paragraph. Click here to add your own text and edit me. It's easy.

I'm a paragraph. Click here to add your own text and edit me. It's easy.

I'm a paragraph. Click here to add your own text and edit me. It's easy.

C  PROGRAM

I'm a paragraph. Click here to add your own text and edit me. It's easy.

bottom of page