0% found this document useful (0 votes)
65 views349 pages

Computer Printed Note C

Uploaded by

sudin khanal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
65 views349 pages

Computer Printed Note C

Uploaded by

sudin khanal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
agra aah mare eve ater after erga, APT VEYA NCIT College Block Diagrum of Comprcber C7-rreuiky Processor _ ——— = 2 fecnier onet |p —~— lopicedi vart. [ L, een Main Memory en eal [Auxillary memory |e 4 ———— T |_| Arithmetic & — — i l t f 1 i t ym ed were ewe tet ahh a a * URTeEATEL, FHT RR VIRRAKRR — ‘ ms NCIT College Mogram ping Janguages Cp) N \ Low lJeve( H h bisa , leangeage = Machine level languape 2) Assembly. 16 vet language — -- ~jUse only. O's & ahs = mnemonics were used “4 fast [high speed nm tranclatons (assembly } ore =| clifficaut to use _ required: es 4 = herder te debup sutdsy to. unclerstand .& vse machine dependent = efficienty No banslation required. sultig.eren prep pane dl _.. _=| machine efficren: 3 ew, lan; flow user efficiency ee ie hanede lemor penne a maching ol ae =[tine consuming for coding: Hslewer thn machine level lan ____D | High levet_laogudige x. “=| etecon ko natinal_lenpeag ey a { wired «Crnaay. be él : y easy +o use (program, Slower jor to mainte eqs be teats miEtees. . deby lees Hime conavming to rors at |_readabi ¢ —— — fuer 2200 aya i eee HEHE torr college M- 2 Deg. OL p20 Gay) O11011 Explarn about different types of psoommmin: fangenges -| The languages which are needed to. commonicats worth, the computers one known as computer lanpadges: Tey also called artifical ov peypramming. languages: Programming lenguages use: simple ebructnes' cohen provide: precice meaning ond understand by! computers — jonly. Enutiese langues en! »one! statement. obama Tabi -lone »meaninp / message Lo. the: computer swleo, sderslah toi niéteiaad ilongusgsk!s Salle sesotte.. aicerd (ng “40 ‘ihe! jngteuction: Sjidate peovidedl! by os: These L instxucttens axe pimen’ : to! theridonipuben 5 promi languages. Basically , computer languages recliveedt yet Bicovtepowies.: -)idpga levels : (ask koko Nevel. langdap es’. These ore the machine ostented _langaeper Suitheyl ene. | eave. esily understood by. computers _| but people feel: diftintt to Understand them. They ane. of 2 typee: iaiest Machine level language Tt ig the most basic of sll languages Te is direcHy because it is | A: Computers the only. { Janguage computer understands hepresented in terms of. binary _ ido not require interpreter /compiler te understand _[psogmm soxitten in machine _level_language-Ses psogram anguags. executes faster and machi Bubp tt requires lots. of time +o ettstany. also high even _a simple _prepram in this language. Aificule 4o use and hater te debug. Sos tt is tore emer psone Ie user efficiency. also, decrenisea a3 Assembly Jevel language - “ i This. language use . Engligh-like abbievtations called maemenics for commenly. used .steiags ef fichine language They ane easier to program than viiacnind langua, because they use short toords 46. represent: Some common operations. They .can'bnbe diréctiy Sreciied by compotens So, translators (assembler) ane jrequired to convert it to Machine language. before exewiten. oi ny 4 Assembly level tanguages (iotie ndching dependent. GOs: different rip os 6f ai einbld ‘Neopubipés ane develd ped for gach Cpu type - Tt is weny diffradit ts, watte lensthy — Pg in_assembly language » And vib sis | heinder: tovleann lau the mnementes. their syntax closer to human lanpyapen. They ese fomilian English \ike words rather “thon strings of binary. cligits So, it is easy 4o read, writes & understand omputen psoprams in high level languages: However » high level languages’ ane sot directly understood by CPU. So, compiler or. interpreter ane required to convert them in machine language. Prgmms _psepram. dead not to be translation. every time. wh for execution. obyee recompiled for _execuiton next CG ctt , FORTRAN » 29. @GASEC> PERL e-g. (gare? want ye teat we TT HAR OTT NCIT Gotioge ehh olen darbaped sea pb liverid tis eet ¢PITM CHAPTER 2 oftoare Development Life cycle (epee) [rpuen setereion | v Poe “[Aigoritien © Flowehant | a —_ = “ Tecan | a a A i — | Teemprtatvon & Execpiten = 4 er — bebuggnng & Testing | 3 y— [pec : 4 4.| Propcam Definition ‘ 7 Te is_alse caied _ptem analyels. TE fs the first step in a oftwand’ (S/o) development Th this Step wa should’ specify fellowi np things - ue i) Objecttves ‘i i) Input _cequrrement: ) Output requiem ark iv) Processing, requirement v) Evaluating feasibility 2: | Alporithmm & flowehart yi Algoxith m ig the sequence of ineteuctton designed ih sich la eooy shat if the inshwction ore executed in the cpeube Jaq vence » the desiced result [s obtained. sthm maigt teeminate: & musk nek cepeat pore statement fafietely ath ny must. hove frocks. nes _f foe covilts coviting. sit | Make suns that _—+} &_sinple exit point | nee 8 ___ | Features [Pscpexties of _algerithm on must: terminate Fen A. | Fintteness Termination. = Ao algorith a fintte number of sleps bbe -prectsslif 2. | Definiteness = Each etep sof the: aigodthin. mud. defined: : A ‘An atpoctthm can have zero ox ‘mow topes: SInput Input + pittaly ones’ Jpisgtam suns: s can_be given goes gue ‘eared cos ult Jan edlgorith vs s ey ig algorithm should be mois ehesetive: omong —— lem, solving: * Zs ae oreo * actet how numbers algey Ptfans dv 1) start CY Ya ee Tad ae BQ Tnpat 3 &b A) Calcplate sen )| Display /psint Stop |nette an algosith™.£ a) fo eatouate. 1% 2 Stank "table ts band nee - “of rectengle 2) Declare _ 3) Input 1 ond bo 4) Gilewlake area 21 Kb 5) Psinf anes é.) Stop. 4) [To catewlate simple Interest. D Start . 2) Declare variable PTs R and “Ine. 4 |B) Taput_P,T & RK isa aot hoe l4) collate Jnb..= (PAT * R)/100 % 2 _|s) paint tnt: 3 Osa ‘ sions 2).\Te_calolate” asa when 3 sides, ase Si 25/0) Start f, : l2) Declare vaniable-.s,0,b, ¢ 12+ val aya(atyals ©) 5) Cateaote 6) Pat awa 4) Step vert temp in Feanen! ahen ec ga ~ 2) decane variable F&C 7 3) Input _¢ _ ee - A)calwlate Fs 1846 +32 we 5) Print F 6). Stop ©) Te calutele area & cirwmfnence of circle: es 4) Stank 2) Declare _varjable v5 Area & Cictum B)Input : _ 4) Colwlate Area cid ®ve (re) ‘ (2m) Cis a3 'S)Cajelole Crrevm 293-14 # ¥ 4) Peint Area _&._Cireum Pala. ges eae eB £): LTe find whether een ne. fs tye or ~vei suse, Yotne Gi Ro hears | 2)ecare variable i Prot _ “positive. es narra cen ane ; Prink_negaty ve 8 Slop Te +13- je uhh B) Te fend cone thes gies ne 2) start 2) Declan variable Dum -—— | 2D anpat_nom : gr2 0) ns = by) te Bnd maximum of um 8) Input f° a) re ery de : e = print 2% max tis. ist else a print Y max 5) Stop 7)| te find maximem of 3 numbers 1) Stok l2) Declare. variables % 24. Bi a) Tape sey & Z 4 xe (ey) aero ik (> z) i$ QY>2): print x. fs max: print y ois maxe hake aon rele nk 2 [s_max Hew claret It is the, diagrammatre sentertron of an algerthm. re View. of the proprun. Tk is Floweheret i the: pretosreut deawe by using baste. blocks cabere each box/ block have _ Meaning Stant/Stop To. repres ant Start & stop of the pscgrany: In put/outpu+ used to indies int S olttpet oft the. cota . _ used. br display. By Rectangle. Processing > used. for. pactanting AL Lalas ds t |eDawdston 1 Veet cohen. clectstan/. i ih benching ss_to.b@._tmack as = wl ess Se : oe ese. “fo link cagnenh Se epfingsct.. 31'S a a | [Eicedajmsl 3 ‘ventiate fave - sft. peegeun oiciislbete ‘ 1 Seasiahde os iors xe ty, add. Bombo’ Floochar eee aoe coe Flowchant 18 find atea! of: rectangle. S 716. find simple toterest Rec chet Declare variable PTR, Trrtenrest Jinpat Pst B/ v Tnerect = OF T*R)/i00] STE Tey NS Seat Zo v i i ‘Stop Flow: chant to find area Cae) Gz. chron mfanences of circle. * Dedace variable > ales Input, xf v |Area = GA BAG ELEN 17+ Fioe cient de g_comert cemus te Panenbert Fawehert 16 fina xi zimiM of Bombers Se Declare variable._Pa 992. i ¥ | [display Oa Display 2 ig_mmaxten is _mraximuiny Floachort: -19- 3 Codia Algevith mg Fasvce co & Rowcharts. are designed for bomans 5 computer cannok Understand sso, He must be | esttten ta PaEBrAMMe Ap. language, Coding can be clos Lin high lever language | & lowe lever | {must be done tn lengua ge.-TB.2_sadin “liable. readable & efferent eae —|Each_ Peg ram mene —kaguape hes its San_syninx. So, we owe. —|shevid _ PEP eey fy lose sules and sytax cohtle coding Br C_ pro, Fomine coding oe use _- text editor of ct ~jsemplle: The statements Shovld be ar 2c {should be Added —shenewer necencany. 5 \Debug ging & Testing | Debugging fm tha psecess of Isolaiing &_corecting oy ‘sre of emer. Debugging can be dene. in. various ways + | ~erser ‘so ~ break point | — back tracing = watch values |Vorious types of exmor cca In _pacgrem: ) | syntax exe 2)| logical /Semantrc emox Testing i6. the paces of exeuting apsogram Cth Inter: of finding moe. Testing. 1s vows taiportian phase « before _ delivering. softare, to. diistomen> aeutos Testing is done. fox + Veri ficatvon vaudatron Quality Agurance Tectrog may. be Z. Human TTes:kop Gompyien based Testing: ad +2he i Taggers mn, documents contarn : Analy sis cocument 7) Pesten document or 2) Pavgram tea 2} Com ments plaheratomtes of usa in q932-; |... —iacb = FORTRAN /ALgoL Z 1963 - CPL 1 ssh 7 196% ~- BepL a. S 1930- 8 : pe 1is72- ¢ Basic structure of ¢ progrcuin | Stouctuce, ofS. pacgram —implres the cempesittan of < pregram Ge. main com ponents ofc. paegram, 0c Link section Definition section Global _dechxatvon section Mara _(.). function sectron £ Declaration part Exaubable part Sub_propivam . section s Functian 4 2 Funetron 2. Function 0 2 is, pois LL Program to peint. your 02m Proprammed.s on. gobo 11 240s Proorammed...by. ..Rubiy ‘ ingluch $telio. -h 2 Subpg 2 f # HE fhclud es. < contour Sr uatnt hs ir | Nei ds mextn Cu)! furction dot dah hectare 2 f Fos on tge z Sol ger spdot.¢. (My nome: ts Kies?) sinh a, geteh.C) 3 iat = eas < character set The set of chanceters, that ane used Lo form worg, Rembers and expressron in © ig called ¢ hover case’ abpnatete 7 J Uppercase olphanele » vanalfe Larabie is a name Ie a breaten fo memesy space where constant is stored . onstent [os | A sonbte Lo _| dosing < es [enostone 7 Consiont ik @ quantity that lestnect change This quantity can _ be sto. at location 10% . Types of _constant 3)| To 1 @hdle nom thout. Peirmonsy Secondo, rhal Integer constant sob Reat constart 1 Character constant ¥ : 3, s ‘ ‘ “too typeo: rectronal forgn ois ou Exponentios fern oe oe et ineorwiiry o2ho ah spptalirithasnsr ais | Fractionot form: :.at least one..cight »must. have. cleetmok point ep. 2.§3, -2-8 5 453-25 Be meee Lb ed as tissa & €Xponent Exponenticul for in en , fosm : [ mantresa, beg 8s4a ed — asu.453 2. o-$e2 wesexved weeds used in C propran wesenved words used _j erdé whase oaning what been elready ie eco tel Variable na since its Meaning has already been defined. sis 92 keywords defined by 2g: Ff keywords auto int ANSEE: im prlor. else. gbuck * char break for ——} cher bres dovele Fail ul for : namiog eae te Dla so | Variable name must he declaned before wsing it Q> Variable name shadd be meaning ful: Although “ib isnot hard 2, fast yale Less cegerel practi Jouse 'myarmatiag yarlable name 1eg

48-57 Data Types. (Vtmp)s : 3 ATS/PR Inc , data typec tells tha comprtle,> about the type & nature of the conctart “to be istored “fn: variable» ec of dete. typec are supported by Cc ach oft be! vepresey Hin co% ss temoay: haracter (char) = Bovble (double ) ~_Void type (vole es ‘qr et earad qa dae ait TGR AIT AVIAN, ae nNCIT College a Lotege: ' s {YPe ? one whole Tp em quater i Memo ey numbers 2 ime er “bytes Compton de oon ~Spauifter nos d mpl —dependent) _ Rea; aaa 5 of preeysien a8 te 34 x 10° wee a4 x10 Float & 3 as 7.83 L tye’. = Memosxy = 2 hytes = 44 dipits of precisron Type quatifrer = double Format specif en = she lt Ronoe = S dovble a; | dovble 65 5 | Void type id Specify. o. itype: oft fiunetien : soy. value: to \éauing, fiuncttoin, 1. nL siuees | D.PR._Signe: Sure deen —_| 2 P_unsigned ie og eut “31. =, Pepresen ts | Xembers “Hype quaufter Is signed int ov int =|by defulk au voles ove, es unsigned both tve & —ve represents +v2 nUmbay signed. _ Ran, 2769 to 432263 | Short int EP double, grr Bart warn wa were ae aera, AAT SVU NCIT College Vahiiable declatatin A vatiable init lization int wells // vartable — ceclaxatren, P| Naming © veniable along with ts deta tyes. fos programming fe ented vor We cannot use any. voxfeble fn the psopram without § |declaxaking it before- _ eg: fot voll 5 Soll ig a vouable. of type fotegen well _con only store the integ valves only. Voniable inflyifzaton i wee . Assigning, any value Jota, Vvaxtab| fs “Kinovon: cus. Nenioble ini i Nizatron: iTewite! 62 types: ‘ ee DS: ic 2, wr oritizh toni. sun Mneivfatttel atten Compile time _initirzation :: ep. inf aj. /f variable; declaration. jalitey -compile Kme» = 30; I vanidbleniittlizabionsets bab taret print § Civatue fate igs ce Uo.) "9 D.volneief-o 18 wor si ortiini gucwy" Aes int @sb 4 sel doses Wz SOs. t “a 2 x 5 $= 60 ie i ig el 5 s peinty Civalwe vfja fe Sid: and! valogio6 sb te Yod sad) Votive of oy 16.S0 Land) oluen ef bb ts 6 : UM Verh werd Cs Tae ae egg. TEMG, ate WS MIAN = : = NCIT College r Syntax: Print i “content string "list of varncabtes) 5 | enteol ote ing. FAD MCE of charachers NOLON oo Dtormat speufier [hd he, — Slescape sequences [/\n 5 \k laned Venable as! Seant (format Specifren”, lietop Sddvess of'-variables )5 Seant (“fd Ba) ‘ G address of a CRs. ‘ : Noid mace () Tat xollnos 4 print ¢ _(“Enten. your voll na”) 5 Sean (2%! 4") Boling ds Print § (“your rollno is at” geteh () 5 roll no) 5 Yeidl main (:-) fot aby Priat$ (Enter io seang.(" hd | print § ("A= yed and B zd", 9,b)3 geteh C) 3 output >| Program to add, be numbers eee void_main ( > ir ; : Sree two oie. int a, bssum'j » | reaute te ans ws print ¢ (Enter. two numbers’) j ety ee cant (Spedpa,&O,& bys ae Som = oh b baad printg: ((! Reco tits: geteh C5 3 Siu hee Sos coh ev Poth Reig Tb \ : piiotg Enter three ge.valyes!’) i. Stang (e/ed rad id) &PAAP LR) 5. Eb = (PETA RI po biee. flog phials ee ‘ | __prints (“Required reevlt. Is. ed", Int )3 getch ¢ )3 es 5 : E 2 : abe Operator (xmp) TiAn cperater is a symbol that operates on certain daw tapes ox data tlem. : et ees ~ Spemter is used fer axithmetre & lepfeat maniputertion. [The deta tems that cperatoe ack upon axe called Operands: = An expression is the combinatton of Vexiables, cofisiants pod operators, woxiten escadting te syntoxe mf lenpuage ep. atb-5 S-} etc. Types to be. classi 2 4 4)|0n_ the baats of ne. of operands. Sania 2)|0n the basrs of work eet rt eS Alon the ,basis of no.ef operands Saseentss at -{Unawy “operatow i inkeo only. si Qt? ena plus att, sarees eres: ve Lcza T 7 : post predecremeént penate'y operator ‘takes three operanels _@>b) 2a ibs -|on the basis of wove obit thy 4. Avith metic opexatox 2. Relatvonat, a —_ 3-_Assigoment ” _ A. Logica’ openaroe S- Increment / Decrement’ opencttor E+ Conclitionat epenate + : %. Shifting operctor 8. Specral operator Z in 1.| Arithmetic _vpexctto'r + path. = > ach) wink Se foboeifete a : Day * frrt_& Hoatiz float: + KD ak we Float & tnt = Float LD ath: float & float = floarbi ‘ fee 3d i ok | Relational operator: i sie Shiga Sha 32528 32 225 ; wie. uset. to compare two similax opexator , depending Lupon #eisulte -37+ Ssignment- operator. ie 4 assign the, result pression to a Veway, = Meaty done by. 2| a=b Gab ot=b 9 az atb —— 41 Lepicat_operater i Logical AND > && oe Conditional opekatey expression £9 expression 2 2 expression _3 @ i — v a saue value false value condition Noid main (_). fab int a,b, laxpe 3 pacot¢ (“ Enter. tics “numbexs”) 5 can (died Ria, & bs toxpe = (arb) Parsb >, print g (The gecalen | pombe, is Yod 2 I getchl D3 Altemate ivetd main (.) its et +39- B Special opehatoy i comma cperater. (2). | &S-fak_asb 5. of op water CX) seang (“4d 2 €a)s rement / Pecrement opexatex es ata Bae +t > pre Increment _ t+ a=ata a au=- ? post decrement. a> Dazaa =O pre decrement Sree a=Q-3 a)) int op 2Vame of x tg pone peint¢ Civalue of x ts ed) x5 Cinco teers — paint ¢ “value of >¢ = e/ed & yard” 2 5y)5 e)| tok xay 5 = *225 Ye> X23 & ¥=3 ye thx 5 5 print (xed & Paved y254)5' d)| fot x2 25 - ~ ee YP P Value ‘of x=2 print te (value of x sch”, ett) 5 value of x=3 peiobh (“valeie of ves s/o! 30) 5 ©)| jot x= 2! ; iyi prot (fvalier of é 5) 5 XPD volue of x= 3 prints Covawie of fy -Value of x=3 p sta gay key 4) yerre oe 2) ysckex NY i equivalent 40 - 2X DytS _ Me XtTD Xe S¢1=26 Ketl > &2 SF1=6 Y=x Dd gre “AL ed 8) yea-- Alp equivalent te Psingg (“a atta); Qeaa prints (“azeed”, att)5 azn : print (“a'atfed’? g 5 = : getch (_) 3 : = fai tightly 4)| x28 y i et ee Up equivalent to Yr ty Bi BtSs Jo. AE X41 | Sta=6 Xsxtt > 6+ 2 | 5,4 Yo Ket Pett Vy . inh KES Y YE Xt tobe toot AY equivatent to ee [xs era X= RAD sea Me xtd 2643 6 »¥=9 *%| x=3,y : SE . ye TE ee eH ot i The equivalent expression. te Le Bus xtra = 3t=4 5 td MkL=S ert ae : YE Xt Ab At Xe = StStS HE = 29s Ke xti = St1=6 ye x49 2 6t2S2 rl Xe 3%, YE 20. ly Ea int Yin Z = yess zs 5 : es Yih pe yt Re he i 2 Soo ee ea2d 6t242 = Rs & | Hepa eae hs : porn Ze zds A122 td 007 - Fall Bea) What ore the fined values of ar bywancd x alter execution of the felowing, stelements 2 ink 10,0 210 5B: Ab, 2 xt = Ha- ptt The equivalent expression _f. bid 2 Qs oftsiotis 412, : TVD if ee x = X+ (a-b) = 1o+(32-11) = 1040210 b = bt1 =41142= 22 Go}. (2a)__[a3}. fra]. z x a 6 #42 Ye, The “equivalent expression 1s zis zfa = Bete 18 bis bok FAB ME thos ine xe X— (27> b) Io (43 % a) Pag bth x go Tie teeters: tn Es 1s Aidit & = o+1= i11¢1=12 aA x = = x¥* (atb*2) £8 ¥(aat11* 13) = 8 (124443) = 2aiss 209 Zs 2-1 i13-1=12 b= bri = tr. a2 2] [za] Jaa) Ted a ete “45- 2o08- Fall 3-4) Given the code below coxile the output of the Pop re, ## include : rely # include Sconio-h > 3 Es Noid mei | _chsscr( )5 d\n”, %4y 42) 3 os prntl (“Given x= %ed yetedand z M = +t x +s. 2 a paint ("x= ncty —sétlgns Bed to x3 \n" x65 X= Bs xteg; : : 5 peink® C'xte y assigns Hd tox , Na”, 235 X= 25 Ze z*xtytts peintl('z2 2¥x4y a assigns Hd toe s\n" {22 10; wit =2* &+y) 3 printf ("2 rf igh thd ms 23 \0"5 - z 404 ft dag : ZF = x4+y3 ferk pink ("2P es ety assions "eed to % 5 ey SH z=103 . #2 xtY3 a z ,. s\n” : : rot € ("ZF= TY asstgng Yd toz 5 Mn y2)3 bh. C D3. gete Soi” x23 ,y24 525 = THEY _ ¥ J me _ _ ts zsz*txtytt oe vw RX¢YS SKQATW = 2044514 & ge ytd 2 44125 2| [5 44 fea r : x z *Cxty) = 20*(2t5) =10%# = 40 Loh nin 2. s (ene bres | Z=40 a aks Xt. 2s 28Gty) = 40% (218) = dot y eto. Fl ® 2a pot ie Z=10 nays z= xty > Z=2* (ety) = 10% (2+ 5) = 19h G 2H9 ER Outping 1 Iven %=3 ,ys 4,and ze5 KExty assrens B40 Kis 4 assigns SLO, 8° Z=zZ* x+y assigns 24 to 2 ze 2 ¥(xty) ascigns “To to z sass Zk=xTY asstgns 70 toe zh = xty assigns To bz 47+ 2009~-Fald 3-4)! verd main () —j— 00 ,n=SO; = i po PrDLE ("yYed\n %, 104mtt) § Be a printf ("Yod\n", totn--)3 : a print f ("eed \n", 10+ ~-n)3 iu D|_outpat + 404m = 10+ 109 = 430 s Aan. Ms mtd = 140472112 : 2 S59 i . + do#n = it50.4g0.- 68} i Ne nb2s 60r1 25H v + M=n-1= 59-1-58 A0tn = 19+Se 280 20 10 + Felt 3-0) Ht includ e-< Stao-h > void mar (_) soi aye The equivalent expression is ge ght = 2ov2= 2a al x+=20 ‘ : x x120 = 9420-29. feal_[aal 11. : K sy) Yer ge-1=321 = 36 S)) xtt Ds xhasi Here, x==y is iaue so b Woke 4ty i ru G Bea Oueput ‘ 5 =BO : _ 9*,30 wake genase, g " fide) ey oN Be pce! spe eens K 260 iugee oe cout hl fp 2010 Fell Sb) | main () (nt X=16, y=19,2 Re xyy2 ase pope Chex 2 a \nly Sol: ee : AES ip ye Me gh ot a) yt xtt The equivalent e3 predion ts 6 i. Js.Jt% = 18+76 = 34 Kel = 6b 2a! a RT lea tiie usd gos eee mE a = The_equiveuent 2xpresefon i Reeth S MMAR Ny oy ie = MAYS 164 94 25209 yin Ty egea 2/8440 BS os Xe xt yt 2-- -50- 2012 fall ape), wid main) Int x= 10,4=20,22551 5 F(teyt 244 8 ty Aah 2. [et 2 5 print f ("x= %d\nyersd \nz=%d") x, y,2 3 printf ("Nn caret t) 5. E : 4 SolM + rho y 310 54220, 258,05 be Tee CERYT ZIT) AD YH 2-5 0" The equivalent expvsksneditesy + y nyeds 2o¢rebahirs ve} che Lei x¥ (4+ 29%3 49/x ¥ 2-5 = 10*(2145)708421/20F2-5 = 2+2 hy 5 IDF 26703 42% 2-5 E St2 ye edht . 26s 3 10 ae xtc z > XSxtes 1o46 S46 hh +6i2 5D) 2=40 > 2224102 6t10 = 16 [1s] Opermioe predcedence & Assodiativiby ' 2 @=h 2=55b53,c22 d=4 i ss atby A mai |e Lee sta, ¥2 a : an = Stitt [operation]... uy Fea, Ci tae af sts. Sta] “2 +52. Evaleate, ax tse + 5/5 t4-2 te/p 4) Ke 3*4/5 t 5/5 J perform slepwise ae | solh | ke SE Mot Yost 4- 146g _ ——_ 12/s+ %st4-1tG/e [oy 23/5] Psd Sa] 2+ ase] a4] #-1] 640] 2. atta 42/3 ¥ A cos Shot 2/ai% S75 Lenanitin 3 Dak W384 OF 5 +25 RG eo 8 2 42/5 AA/g Parting the vatieo in given expression . Ms Bla + S* AZ — |b 1-5/3 j Sat 3*4/3-9 + 15/3 (cperane 2 A49%7/3-3415/5 C. ret a + 3/2 * Sec + 2+ tht ecah and this 3+2,assime wes to be Pate the values in above Jexpracdion’y AA ALS F3/p HA 4.24 3-2. 5 Mio. + Be ® 4 +2432 FOB eh Lt243-0 5 ZhLSAFL+3-2 « At Dt QotiB-2 EY StotBb 8) GEG hrTeA OS RRS 2 f= 3 lee Putting the wluee in gryven expression’, p= BR % 2/3 4+ Ca t6- 3 BMG /g - : Sat V/4t6-3¥3B*YQ [operation _ 342) BtS4t6-3RB¥H/Q oT gD RBRS/ BR es sla] 2414 6-9 *3/9 oy ee eee Btit6-27/e I*3] ' 2¥e) Peta] i ve Brey 9-37] a) i= oth e4o@~- 8.5. float @= 1-5 , b= 3-0 Boe fet Wet} i Putting the vetues in given : expression, Die bei F Mio +. 2-007) s Bo = 150 + 3084/5 -8.0 __, [operttven Bee] = d-Se+. 12-0 is Eon BOR 4:0 O-n8-0 Riga)? Aes Le. = 9-5 - 8-0... VEE ans F tS0e8 =A os = 2k Sta/etARAR ARYL, £ Keparetion S73. = 6+7/8tak4tayy | Caw: 285) = EF OTIEY RY B Cet Ye]: = CFOF1E KY YY t Give 1) AEA] -66° = Stor 6 4%q [operation 16K 4] eleeed Seed. St xs op sega | _ ene sro] hapter 3 i Contvel_medaietions fo C eae eee erence fppipieimetens ee [pe Tyeedecanttion ineuction = 12). Axith metre : 2) comtrel nstauctiony conte! insteuctron loop /repeition / iteration contre! instructor _ slectien / branching! decrsiea centeo| Insteuctron -[case.conbel ingteuctton (seoiteh) sequence #| Loop conbol_insteuction Hf €2S¢ contre! instruction while loop : =suiteh sintement _ do- while loop ay i fev Nee er insteuctHory, #| Deusfon contra! , - - if e - ff else ahnets : — nested ff_else al NS = else Th, ladder. - conditional operator _ | if + aymtax if. Crondstton) +57- ay Iho else | Synte | Elowchart -T}, (conetity on ) jo See fig. Flowchart of ff else Pepram to demensivale “Ty? ! WAP [fo pércon can vole Hf include < stetio-h > #H inchide Conio:h> void main (_) q) _| void main) Program te Aemonc}rake iG eke” Wap 4. check Hf include | He inclucde chether a person f int _ape ; ; paint § CEnier your age") s ean vote /not sant (“ sod", Sage.) 5 a if (og 12) £ : peinty ("You can’t vote") ; 4 ' : else 2 Eso” : pridt ("You can vote") Z i - gereh 695 \ : y Bitte EON Ss Urea | — = ange b)IWAP Yo check ipives._Kombisx ie positive ov negative # tocdude Ss: t HH include qual fe 2) WAP te check piven number Ns edd or even fp include de include conte h> void main (_) dis even", num) j tee i print ("eed 16 edd” , num); getshl) 3 atl op 22 . rane y - Powehort ee ; Zoe oN Vectra vartoble nua iigckbich Arsiemcars fae pen / 64s A) WAP to cheek tf a person is, manvied or not Cbaseg input character ) ‘include (stdioh> de 15 (conautiog: 2) ee Re a ____Statemen t/s j €) if (conditton 1) else = { : __stolement/s LL 3 — i u b)I if (condition 2) “it else fp eli ae Statement /s_ Statement/> 4 2 else 4 t ese if (conclitton 2.) t Statement/5 £ Statement ys elce £ elge Statement /s tee Statement(s | i Absence. eet Eyes! Wet ae bones" — +63- enditon3 T Leraichene is _| [actenar [as 2] sete vent /s _ + Stop HhP te Bid aXinyns of 2 avotwons & dhidse ts. Modchdt Aeehehe, : WAP bo Find meximum of 2 numbers S2 draw its floc ff include. # inctucle _. verd main () oo kee int a,b 5 a _printy C' Enter te00 19 umbexs' 3) 5 seang (ad mm yd." , Kol, Kb) on | if (a>b)s eyes £ : 2 prot gC ed maximum) 3.0: T 4 else 22. plemep el oy vis £ 5 getch( J3f5 sy 2 fe Flowchart print £ ("ed is maximyia’) bls = Pete) jh, Stand). a NAP to Find astm of 3 rumbets Scraca ity fle # Include < Stich > i# iecludes Kéonionh > three number: cae Piewehart Gtoxky Declare variables ashe 67° 4) else if |addee "| Syntox, : 4 #6 Gonition. 4) wna fk Sg og sees ae else if (condition 2) ; _— LF ON Ed int —} A statement |s 5 A Joy a pa ee T a ~ . isle - s == tatementis ; = ee hart +69- WAP é find maximum of 3 numbees Peng else i ladder. . a 2 scant CYeiydipd"! tf arb && are printf ("Yh ‘ie pedigter ", a) ; a else ff (b>) ead He printf ("ved is greater, 6) 5 bases else uni 7 Print" *Ad is, preaten" 3 getch (3 ot i r WAP te Binet madman of 4 wmboge A Bical maximum of 4 mumbens Indude ¢ stettes h > ps A ide _¢conio-h > ! int f (" Enter. four numbers") 5. ' et "tad te) tT venus Chea 1s grealee, bjs — = 70+ else 1F CPA) print ("he is groaler's @) 5 else printf ("/ol is greales", d ) 5 The “Type Casting : Exp leit type cerver son WAP te input markes of S subjects A based on Perea Rink out the following : PEX BRO = dictinction 282 — Pens greater than 69 kss than 80. — Fret divicren include H#include conto: h > void mein () Int _Subtj sub? sub3 ,sub4 SUbS , tetauy = i Float per: s re 38 duit paatf ('Enten marks of S subjects"); Saanf ("Rd fd yd faded! aes Ast ghen Se. caaa] et = subl teub $SubD #Sub4 tubs 3 a Hleat) tora ‘Smo if (sub > 32 Bi Sub 2> =32. 6 Sub? 35 Se Sh Sub4 K& subs | = | | 24 else + pent § (C"Thd Aversion") 5 else ____printh C"Fatled") 5 Fgersh O)3 oehonacter, &,. determing sohethe, 2sigit.. on special ugg mbols. +73: Alletnate: void marn () chan eh 5 "); Print § (“Enter a character) 5 dong Upe%, ach if (A> 92 && eh<= , | PHatg ("You enlered loser case character) be ig (ch >= 65 BR ché =90) ns Prints (You entered opporaise, etavacter )s else ig (ch>nae £& chOzS) Prints ("You entenad atigit') 3... . else : Oe Print ("You entered spect gymbol “Ds: Gerhds sie 4 84. Company. sinsunes Ag VEng: -|TF chi ven is married aif driver is* un manned more nested If fe include Seonio-h > werd man () t __char__ ms. - - int age; = - a “shar genderi_—__. _ _ __ printf. ¢ Elen your marital status (Morr it sean€ (“/ec", &ms) 5 es —— printf (Enter age.” )5 4 Te een Cred" age) 3 a prinbt ('Entew gender (Male =™ /femate= E ys | scant C"yoo"s & gender); : £.C0g.@ ?. 30) prind py (iSiYou. axeinseats de Ss eld Se Jo jnene - Fee so) ge OP IAEE C'You ane gob idewred) pane. eed -75- # include Stdio-h > H# include Meid main() Se | else if ladden Wustag epernioes 22, = ny bess if Gms = = my printf ("You are inswued") 5 elseif {gender ==! 88 _else tf (msz= fu’ && gender wT print Cou ane, insured) 5.> SL etse fe mse = tu" &le gore | ___prink& L'You ano. ingured', else. Hise att printf ("You one not insured") _getsh Cds Ki | Alternate : |_| void main ¢) 1 Le aid’ ohas CC) print: ("Yousere ce 5 _ pet Cou _gerevk Dabs 3 j “17+

You might also like