send and receiver side parity detection
#include <stdio.h> #include <stdlib.h> int checking(char *data) { int i=0,num; while (data[i]!='\0') { num=data[i]-48; if (num=='0'||num=='1') { i++; } else { return 0; } } return 1; } int main() { char data[40],rdata[40]; int i=0,count=0,check; printf("Enter the data : \t"); scanf ("%s",data); check=checking(&data[0]); printf ("%d is num",check); if (check==0) { printf ("Error.....\nEntered Data is Wrong"); return 0; } else if (check==1) { printf...
Comments
Post a Comment