Even parity and odd parity check program in c

Even parity and odd parity check

Here, you will know about parity and get program code of even parity and odd parity check program in c programming language.

What is parity

Parity is a method used to detect errors in transmission. It works by adding a single bit to the data being transmitted. Parity can only detect single-bit errors, it cannot correct them. More sophisticated error-checking methods like checksums and cyclic redundancy checks (CRC) are used when higher error detection and correction capabilities are required.

parity check

Parity Check Algorithm

There are two types of Parity Algorithm:

Even Parity: The sender counts the binary 1s in the data, including the parity bit. If the count is even, the parity bit is set to 0, making the total number of 1s even. If the count is odd, the parity bit is set to 1, making the total number of 1s odd.

Odd Parity: Similar to even parity, the sender counts the binary 1s, and if the count is even, the parity bit is set to 1, ensuring an odd total count of 1s. If the count is odd, the parity bit is set to 0 for an even total count of 1s.

 

Example code of Even parity and odd parity check

Output:

even parity and odd parity

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top