Hamming Code (Java)

Problem Definition: Write a program in Java to compute the Hamming Code and detect & correct the error. import java.util.*; class DanHamming { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); System.out.println(“Enter the 7-bit data code”); int d[]=new int[7]; for(int i=0;i<7;i++) { d[i]=sc.nextInt(); } int p[]=new int[4]; p[0]=d[0]^d[1]^d[3]^d[4]^d[6]; p[1]=d[0]^d[2]^d[3]^d[5]^d[6]; p[2]=d[1]^d[2]^d[3]; p[3]=d[4]^d[5]^d[6]; int c[]=new int[11]; System.out.println(“Complete Code Word is “); c[0]=p[0]; c[1]=p[1]; c[2]=d[0]; c[3]=p[2]; c[4]=d[1]; c[5]=d[2]; … Continue reading Hamming Code (Java)

ISO OSI Model (C Programming)

Problem Definition: Write a program in C to display the ISO OSI model in Computer Networking. #include<stdio.h> void main() { //clrscr(); printf(“\n \t\t ISO-OSI Model”); printf(“\n LAYERS Sender Side”); printf(“\n APPLICATION lAYER !! AH !!DATA!!”); sleep(1); printf(“\n PRESENTATION lAYER !! PH !!AH!!DATA!!”); sleep(1); printf(“\n SESSION LAYER !! SH !!PH!!AH!!DATA!!”); sleep(1); printf(“\n TRANSPORT LAYER !! TH !!SH!!PH!!AH!!DATA!!”); sleep(1); printf(“\n NETWORK LAYER !! NH !!TH!!SH!!PH!!AH!!DATA!!”); sleep(1); printf(“\n DATALINK … Continue reading ISO OSI Model (C Programming)