answersLogoWhite

0


Best Answer

# include

# define bool int

/* Function to get parity of number n. It returns 1

if n has odd parity, and returns 0 if n has even

parity */

bool getParity(unsigned int n)

{

bool parity = 0;

while (n)

{

parity = !parity;

n = n & (n - 1);

}

return parity;

}

/* Driver program to test getParity() */

int main()

{

unsigned int n = 7;

printf("Parity of no %d = %s", n,

(getParity(n)? "odd": "even"));

getchar();

return 0;

}

CODING BY:SONU BARNWAL CENTRAL UNIVERSITY OF BIHAR

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to implement parity bit checker?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program to implement prim's algorithm?

dfgbrgffee


Write A program to implement insertion using AVL trees?

yes


Write a program to implement domain and referential integrity?

give me the program which can related on domain and referential integrity.


Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.


Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Write a program to implement a line using slope intercept formula?

lund lelo mooh mein


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


Write a C program to implement excelp system call?

You are not able to do that, but you can write a program, that uses the system-call./* exectest.c */#include int main (void){execlp ("/bin/ls", "ls", "-ld", ".", NULL);return 0;}


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


Write a program in C language to implement the apriori algorithm?

JavaScript is one program that has been written in C to implement the Apriori algorithm. There are also several other known programs available on the Internet that implement it as well.


Write a routine to implement the t e x t function?

There are many ways you could write a routine to implement text functions. You could, for example, come up with codes.


How do you write a Java program to implement weighted queue using circular doubly linked list?

Add weights to the elements of the queue and use an algorithm to sort the queue every time an element is added.