Output of Program :

student@ccf58-OptiPlex-755:~$ gcc ip-header.c

student@ccf58-OptiPlex-755:~$ ./a.out

Enter packet data

1500

0028

1000

2600

C90A

0101

C90A

010F

0000

0000

0   0   1   1   0   0   1   0   1   1   1   1   1   0   1   1   1

 

Ans before adding carry bit:

1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 0 0

 

Ans after adding carry bit:

1 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1

 

Ans after 1’s complement:

0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 0

Related Post

Leave a Reply