You are on page 1of 21
© cj @ Wetite a pswgsam fo fal vadundaney br+ using vee th taryoge Mer Head_Redundaney Check (vee) om Pasilty Check = : Nerttica® Redundancy check fa also nown ar Pascity Check: dn this method ) & dteclun- dant bit ado callted pasiy bit fh oddid to ecch date unit: “TRA method Phadudes even parity and odd posdty . Buen poothty Mem tho ota nurnben 6h th in data fh 40 be esen and Odel patty means cho total number of, ts ir datn ts to be Odd &> 4) Aowice wants to transmit date unit s1oory uafng even Party do dhe destination. The sour sill have +o pars Horcugh Even fasiity Greneraton. Fasdity Gronorator esi count number @f 1s fn cloto unit and wild ado poxlty bit. 4m example, umber & 1+ fn dota Unit fs 5, parity generator appeands a parity bit ¢ to Shi dota unit making oth toto number 6h 14 even. SENDER RECEIVER bo, ofoftii fi [ Accent oa] [ReiecF Oaks) een Odd paxity Even Posiity 7 fasdly Checkor Grenexotay [LH] Reh |Cceunts 4s ty data (Coun 1A ty ot VRE of os PT b Ly eatin ate) , count =04 chao) 5 PATE C Baten & numbera In a bet binasey “fosmat tom (is o1 eas Leng ’ PaiOtP (54 binary number (4.034 est Apacs) \n> fou (jao ; act! Sconf (ry, © 4 deta COG 9), cf Fost (eo, (<3 5is4) g He Geo BAS Jaa) ¢ (datatiagyy ==1) Count 44 eI = count Count — 0; q ‘i 1H) s ¥ (are %Q! =oyg “nas a eee 4 psi (" th Dota WREAnS fox (fo; ix3 5 its) § fox (J=05 G<5 5 FE pat t ("xd dede COIEyI); g point (nn) ¢ qdth (0; 5 Ao a 3 binary number (abit usith pact) lito Given dota 0104 {000 Ji) 6 Data VAC Olod) Joo00 Jj 100 I furcdion 40 calculate Tmt caeutote VRC ( chow binoxyMenagelJ ) 8 int n= stan (5 inary Merage) ; int Wwic= 0, for int iz05 i< tin ajc) 6 if (Bins Mecage C19 « ajo & Vote +45 5 5 M (use v9 ==0)§ Hetwu 0; Wisc (bit) seven fou even arity s che § Hetuint, vic bit iy 1 fot odol. pov 4 g int main () £ chon inpukMersage Coy; T comet tepid esc te btrayy tr eelanee Asn nbd stoneg fer Unt to, oe Ie fe iMVadiy ~ Tahu menage “fox (int 429 3 dr=o, oe bi : Mav Herkage U ixg _Cd Ge Vatuesag) 5 Ef Pray Hesse [un een : Cabeulote ve \or; equivalent » Paints ("VRE ge, Kane qetch (); seb 9 & yop Oveler fo detect an Gowan, 0 stedundant bi+ ts oddad fo d bitock and this block ts franimitfed te srecsver The seca Wres this Heduindard sous fo datect ovo. After checklng data fox cows, , vaceluer accebta dhe dain and dixcads dhe 4 Hedundant — sto Of bets: 3 Osdgfnal dan Noosolo 1004040 stoo4100 js400044 Hooloto — $&f osofo Meshoo 116 Pxint® (" Ente 3 numbeow fh 4 bit binaoyy seat ‘fox (t=05i<3 sie g pointe (yg Binoy number (4 bt utth pact) \n ,¢ fon (G-0, desi gry g Aart 2d") a deta bi tag), j 5 Plies i dog tos tik HYS3 5H) g '§ (deta teary 21) Count +45 5 QC] = count ; Count > 0, “ht =o; tas Baye (arta, - eo PAO Crd, data rey); 5 Point é ("\ nn) 5 i Pair (44, Data jn”); fox (iso 5 ic3 id) § Tos (eo, I; jays Paint e Cea», deta int); Palin (#\ nny, 5 fox (ico; ice ites § Ce (a » teas Paint? C"LRo») 5 getth 1), § 3 Bihasy number (oth with paca) Jo yy Given Data, 10 Jo HESS bg Joys Data 10 Jo Nea a0 d4 S410 irc chax, menage Lice]; 7 Absuming o max menage Sangth 6{ J00 « Int Lic (8 = S09 ; 1 Arsuming @ postity bits flor dumonstratien 1 Fobut dhe menage GEO E nh, 5 Message”) ; ‘feb (me sage » Aliya of (massage 1 Stdin) ; Mersage Lats espn (mersage “Wn Je i), Remove nauibng 4 PE pourent 4 Aleulah 4, Lre fon Cntice ie, halen message) 5 ia) p Cint doy jew aoa ifloresage 9 Sal ds te 14) ‘io ion Ht (int ico; teg; itt) § paint (*%a", duetid) ; § paint (\n») 5 detuin 0; g Output = << Enter a mewage: frolllo worth this tr © baogsarn LRC (odd Posttty) ? celolon M funcdion to calculate a sfmble d unigned chan caleutste Checkaum Cconst % unsbricl — chas Checksum= 05 fon (fot tso ; F< onsty $3 itt) g Checksum 4 = memsage [i] ; 6 Stetuun checksum ; 3 4 function 40 point on abet value fn has vetd batntbinaoy Cunsfantol chor value ) § fon (int tag j Teo; tyE Patin, Cm", (vadus >> iy ai); 4 a int main( $ chow mosage Toe) ; 1 oudpud sho checksum fr Binoy fosun pxtintf ( Checksum Cotnasey ) ys psdintBinaey (checksum) poder ("\n) 5 Hetuyn 0, 3 Oudput> Enten a memage * Checksum (binasty) : bir os abberdat fo the enol of don unit ? Herubting dota unit becomes exactly divigihde by a Potedatemminod binavey number : At — dha destination | the Tncoming dota unit i diufded by sha sama number 4h at dhis web then th no serkindy, Hu doin untt fs oxtumad +o be cossiect and ts cherefosu accepted. A wemaindo indicates dhot dhe data unit ‘fas ban damaged in tyansit+ and dhowfese must bo Hejected: In=1) Zexo o Octo }oo----0 gu n bth, viAo. j b Cy-1) bits (moxie q Data | CRC (C=o0 5 C); fox (iz, LemsoQun ; i+4) Pont p (non oe Patintp (Cy “mainder ty»); fon Cizo; Fe heyon 5 445 Patint® (ry, « » » sami); \n Finag data ¥5.»y fox (iso; E veld main() § int doda bia) 5 Tht datnadsiec Lio} Paint p (« 1C,C1,C2, 3, es Enter 4 bits, fF ef dala on by ong \n"5; Scant ("%4", &data [x)) 5 maa Col ocean): Scanf ("xq & data) ); Seanf (%% 4", & data [4]) 5 Y caboslotfen @ even posdity dota le] = data ()* dotaey* deta) 5 dokals] = datnto} > dataty * dota [a] ; data [3] = datale} * dotalg* deta), PROME ( (ny Encoctad data is \n") ‘for (=o i feay te) Paint ("% go , datary ; paint ("n\n Enter siwcetved dota bis ong 4 (i205 tay ste) Scan (“%a" Acdatoadsiec Ct)) « by onan”) 5 Cl = dotaatnec Ue] dotaatsec ta » dodoatyac C2] a C2= datoatuec (5) » datuotsec C4] * dataahiec tw ee C3 = datuatucla] Jatnabwe [2] “dotnabuc 01) docs is PACH Cin Dan gent 2°95 for (iz05 tea 5 t44) Pointe Can data[i]) ; Pointe Cry Dato suceived : Nes for (ico; tea 5 t44) pdnte Cray, dadacdsiec £77) ; paint? Cy Gsuiect merwage Te \n”) ; ) (datactswe (9-c) = =0) datootntec (-<) = 4, else dataatsue (4-<}= 05 fox Ceo; fea ; Coy § point ( "Kd", datoatswe (19) 4 5 5

You might also like