Download as pdf
Download as pdf
You are on page 1of 8
2») Pythak ts Pecursfon 2 Devetop a recursive Function +o count number of dig tts Ina given number J Reeursion:- Recursion As we function the function (ow) Be wodleng itsetp ogarn ard again unk qo Sotinfy basic Conclitions » # Kecusiesive) Prograwsrae -to Count no- Of~ digit in Number. ‘ Werte Stbfnetde < stato’ h > int Counter (int) 5 tnt Counter Ubret n) fot, exo > fF (n>0) CH; snetamn taunt (sho) else Saturn c ; 4 ine maine) tnt nyc 5 | Sconf- (« vd”) kN); | Ce unkelig n)s PEC woo digits = ase); Hetusur vs Remonstrate att ae & 0) bubbu sort b COnSTALA IG oti § bu 4 mq USE of clemente B73, by, 12, 1318 )5y ,36 125.10 and lb ee 4s oy AG, 43 by 12 carey by 12 73 by (12 430 by 2 fass~a_ 73 oy, 12. KJ 6y 43 12 fr by 12 1 by i, 3 sy 12 1B oy ee by la 13 oH ag tye % 3 V8 oy 36 ys AS by 12 13 sa 1B Sy % [2s TWSik GYn Thos 13 1B ne sy 36 2S lo 0g ; L aoa Lo 1G IB 1% Sy 8 36 128 fo KH 1318 34 ge a ies gla fe Se) 13 18 Sy 8 4g Jas fo [6 a) 13 8 Sy 386 8 to BS | 6 13 ts SH 388 As ea ges 74 ‘ 5 ta] 13 8 Sy 86 98 io 16 7 1¢ [12S 1S./!3 yao tigmes ges lo ld ¢ ee lo (6 [tz 13, 18, S48 3° : Ds, 43 12 Sy 36 as lo wt (es) ro) 4 sy gh 18 '0 is Bis oy sy 3% 4310 wr oF. at = | Dee ts bY ab 4a lo U6 [78 125) | agen esi Pe? 1 faa 5) WB Sy 86 by 43 0 \6 Sy 86 by lo 73 I ag, 12S ww By 36 a) @ Sy 36 Ww a6 Sy bY Io tb eee] ; 36 94 to by Ib LOHR MOG »24 lo as sy bo F; la 13 ie 356 sy to 12 7195 ip te la 13 —s 13 Eo ee 2 8 R Mig acd 125] 2 R86 10 Ib [5y_6y 43 1 la. “ig! figs Wee Wot Nea esummegmr sae rs i ; wo fish tig SSE TT yg Toned tous ie = 19 18 1B. 40, Bb 1 Sy 6y 43 98 : ¢ 2 i ote [a se og 1% es fo - 4: e ran lo 36 Sy by 43 99 2S 2 13 1 a 1213 1B to | 16 eee es} ss ane 12 1B, ta 8. ples (SGMISH ey sES NEES i Boe Isto (6 [ie 36 sy by 43 28 1S, Pass-8 3 fh aa Wie joe ids, lle ie ele Sumer a les: i 13) Jo) ty ea SSS sg by 42 %_DS, \ | ae Fane pam e A 3654 SF ya to 13 [le,.8 go) Syuky 3 28 ee \ 6 lo. 16 [S4. by 43 ag 1S ie 36 @ 36 0 sy % [by 93 98 BS, ify fey @ 96 lo \16 [sy oy 13 78 (oS Po We Ry Pty 98 a » mbrtesig, Peer ree 12) for (F205 ien-P5 it) ; tated sate) tp, auras 6aTijs alii; ; affaieces dt 3 int marino) © i in oto ny Pi t5 Scanh (4 di", wn);" for (Io; tens it) Suet oe ee —_bubbictoit (aims 7 for (i y Develop or functfon tv find difference of Gmattest and largest elerents of an any 4% ar include < stdtfoh> “ste include < math + b> tht maine) — ¢ tnt.a [loo], nt) maxzo,minz\ooo, diffs Beans Ad" ’n)5 for (feo; fen 5 i++) Gant na", ¥oT1J) forlizo j ign; i++) Lu. (afi] pmax) max = atid if (ati}< min) mine atid diff e abs (max-min); Print (“difference = 7d", Atte); heturn 0; q write an algortthrfoy binary Seaxch « Implement: | @ vecuystve function for binary Gearch? “Algor Hains Step 1. Soot Shp a: Read avvay etornent® Kn e Stop 37- Get -f=0 ; t=n-1 Gtpyi- Read -follow'ng tsps, while (4<=4) Step Weli- Get wnt = Hayy Shp w2t Ih x te equal fo ary [my Sip yr aels getwAn mtd . epee: fete Pye ny Bep st ‘Tp te _propein “peace shen x fs | Dots “found “tn Step: wet 1. | : Sees cen siabe tnt binampsearch (HIT J, int, tnt SBC ean (int aT] pint n tak Ky] tnt f, tar 4) fk tty Prt) t ‘re vay tt m, (Frade 3 de “iP @DRy, =o) ruturn m} E else ef Calm y< k) F - a ‘ gueturn binasrfeorah (one * m-) | “else” qaturn a int roatn 3 5 ; a nt ative) n ve: Amis 2 goang (2 na nd”, ae i): yrfon (iol sytem y ay) 14 Rhos Pires Crviot) se 0 else eae Printt ("key fs found= xd trdex Teturn 05 ) Develop a suacurstve function to count number oF chatacters , worcts and lines tn the Given text: ak include tht moincy t Chan S[rooy; int t, ne co , nw=0,sc=03 Scanf (»y, [Ayn] 8,8) > for (iso; spjt=‘\o'y i++) ne +45 j for (f=0 ; s[ryps ‘o's G4) anomie” 1) Cette j nus Se+14 Print (Od ME LANE fod “MCs SCO); quturn 0; }-

You might also like