0% found this document useful (0 votes)
13 views57 pages

Principles of Programming Using C Module 2

arithmetic relational logic operators, for loop, whilw loop, do while loop, switch, if, if else, nested loop

Uploaded by

Raghu
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)
13 views57 pages

Principles of Programming Using C Module 2

arithmetic relational logic operators, for loop, whilw loop, do while loop, switch, if, if else, nested loop

Uploaded by

Raghu
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
Module 2 . Operatoar in c Arn operates aa tymbol thal- Spe te Lie malhemahial » logetal on sulalonos operation. fo be Penito sumed, c language Suppoxs chi bénent lyfe oF operatooa , Hal ae Cabegori ded ink. * Asuthmelic openatomu 52 | Ot az 4,b=3 We3=27 als 23 q+3 =12 9-3 =6 I1+-3=0 (Reracuinchs) © Alatronad gpeato su : ob 2s ale known ar Compare sion. operates, Niche Goenpesses kioo values, eempoestons thal Contain. sulohoncl gpenatoon cox Called * Rlahonol Expreusion” Ralahagnol operate ouluan Lue ox tale Value fe 10x 0 suuspechuely Scanned with CamScanner re operate Meoning Ex: < hus thin — 3<5 gee a @ > Govala Han 174 ge O <2 Lex than 0x 100 = 190 gv 1. Equal Is >= oa Syed 50> = 100 Fives 0. Checrerclia a es iclened a valid qpenands, Sire Hey arn supereenkd by numeie valua. Ex: “A <'e’ [anaes 68 2 66 Bagg Df - nebo 1. gre hes operates cote Eaaludld avert Let! bo aught r Al- couthmdc Lxpruniory Coe. vud in &tha Mole ot a alabondl operator, then 18! an thrabye Exprusioy will be Evaluald , Hen the sumtls will be fompeud Few move zxamply_ OL xl, VEZ & AES thy (x) pp esoon CO) peony cx+9) * Pal: bo ae palleal L Cees 5 TRUE. “4 (fee! Fbese, | (2 t10-5# Phan value ae DT hear Value w-aty) ‘ Cyne . c 4b nol: Bue, 1k Boo. Scanned with CamScanner : Equally op vale 2 c language suppoals 2 binds of Sgually ope alos. L Compan Has optnands. They 022, oe) bs == ve fgyic) a Thue have [sox prrcedant. than’ Ub aubhopil aperales Operatoa_ Pebeims 41 tt both. operands au Equal 0 ofhemiu fe Rhian 2 i+ aperands clo nol have hh Sar value bp obhemsize. - fogitos op exaboau: c language Aupporls 3 logy tal gpenatoau logilol anv C46) logitad oR Cit) logied NOT C2) ataar , wohich evolualy Jogelal AND : 21 ct Binwry 4 a yyalucs Table shows Hs leg able ot- lngtad anid operated - 0: FALSE J » TRUE ; fs (B [AGEG| c+ bolh com Laue, fen sutullt will o be Lue fa: (a 2b) &4 (b>) 94 bor lobdifron ove fant, Maen npole Expnewron pill Be Lite. Scanned with CamScanner 4 Logitol OB» Tiible sens its tout able ‘ g+ any om Expausen a boule Her sul 1s baue. kx: (aeb)n (ze) D4 any om Lendihon Lue, 02 both the. Londhom an Lite , ere whole Erysubor pil be Lue. og: lod Not : gt aku a Arnyle expansion by negoli th Value or bh Exp neu On, dua aord Lhe Ey auton Leolials A) iA | oF pa 2 ot.) fe @ nen-due value & proddten a‘ ! D 1d the Eempouson paoducn A Eero: int azlo, bJ eee (oo te valu b= 0] . aznon-2uo !14=0, ent Unoouy ponealia Thee operaless ack on singe | "ol inched Unary minus, Incnerin|- te Axcreaed a Uncen rains (-) i The pperaha ss preceedad ky a minw sg” Ba: tat a, b=10; ae Ce) Keasulh 4 a=iP 94 no. 4 -ve, Hhua i) belome re Atha apply Lk uno pws opunciox op eranth Scanned with CamScanner b: Dn coum ent- operabin Ce +) & Decsumeni- openab ae ~) > . Thu op enale on (reuae on dicsnaur Lr Value of i gperand hy 4 Thue operates have 2 Vosienl pohzx & pos x Exporucen, [he openalen + eqppr ical bax. Jna pouh lufow an operand is foldhd. tox. Lemputatren- bes tte OF —— H. Ina pusthx Expou o7, the operator 7 apphed athr an operand in felched. Ea: ink % 10,95 Yextrs Row a+thr Computation, yen then x= x1. Re yelo Hun ne=il 94 YottXs Hore actha Compal en. ye xtl » 9=%) well, Yells wR Same apples aoa uniny Menenent- gpenalose + Goncibvonel gperaton Thi onl alu Lallbed a teynury oprraton @ 2) Thiet an ud, whin hoo OR more allennatiog dan an Expruton. “Th Bynlar wa xa 7 Oxph + CHP Scanned with CamScanner Baxi: large = (a>b)2 a:b \ 94 aun oh thea lange =a Ehe large =b. © % So peu laage 2aon b but nol hoth. Exe: int a5, be3, C27, Small; Small = (@ Bn: ~ 1010 10i = 81010100 Shit opewha: c Suppor 2 bilwin shibl perma Thay ann Ship-letk C<<) & shtt-sight (>>) The synkx a operand op num Kn: 94 a = 0001 110) w~<<| pow cluces 0011 Iolo Heck prtokucer 110! p00 ty. nel prodacu po00 1110 n>27k ps ducu. 0000 vool : Aadgn rant operulias ured ts ausign Ha Valu bs Le yauably = operabos us vue, fa: ink 22, 423, Somz0; [9h will cue’ Variable n with & 4 Y with 3} [pth lomputaon; som=5, Variuble vill be Neth Arde 19hich is olrgred 01th Vai hee Som =x +y; in th. ough Aide") Ene: Aa=b=c=l0; # Scanned with CamScanner e This opouba inc lobes Luio e* operands Br: int az2, 623, %=20, ° lomma openalon ' x = (+t+a, b+=a); OF wonkk by gat ucthing The yeh label rhs Valen, & ben tealsala te 2 5, srebeinrs Ihe Valua cu Lh swull o- the Exponent en Sk Suobuoly 4++Q az2tl=s nexl- swobuabi beeq re bs bta =3+3=6 Db adsign 6 | ss. Fide OF sporalon: pla a vreny opera Used Le Calulaly Me Siac of dala Mgfes. In jpxofiem, Phe keg azo ‘seaeok, 1 Fellosed by ao byfe name, Yoo able or suuiean - OI Ahraminy Lig arnount- oF bremlly Specs Phat Phe Variable hr xpaeccies Chale: gfe vill tee ka: int acto; wrnigned in| steal; ataull- = Siaot- Ca); Adhnr Execution, naulk=2 it & TA an integer, rh sequins 2 by vt Slonuge “pace Scanned with CamScanner 2 penabox Pruecodance choal- 7 he operalox have Loo pnopethts: poorly and auatoh arly Priosibs : shen an aunion his mor then Bre openalor , pouddily Lbermiry Ma onda in yohich the Expriewion vill bs Evaliabed. Axobahvilg: pb dedina the Siseckon in which the. op eralan ach on the operands Brit. He B*R +56, = 124646 [mutliplcakon ban hag hes} = AS Pouddity He + & — C Pou Gana) od all ase +/- then edt lo Be t= Ska onc aught ciondron (A uobahv'y) =l2 +30 = Ae B me sCersyre — [ Bowuckel aoe highal pordity = at a%e Hare meilhemahtod gperaleas = 2776 ten ely = 162 m2 a* ben s/o ot 1, au thew 12% 5/2 withoul- baackd , -Acr_ B/e lett te oughl~ will ke I Peretonmaed | eww co TT > leAY bo oust: x [ofs —> lat oughl- 2 Ddk to 20g ee ae leat fo sug Scanned with CamScanner Eacampls on Operctoay | Wuk a progam L perloxm- addition , Sublauchin. clivision, integen divisnvon, muthphcabon and modulo division on bizo inheger numbexs # include int main c) \ ik NumiAuMe » AN- add sesso, Sub-mv=0,mul-mo=o, idiv-sw =o, modiv- mes =0 5, Cloak tdbv-meszova: Clasexcy; Paik C8\n Enter Hu 18h number’): Scant C% yd, &ouma) > Pant CS An Enben the 2% numer”): Scant C* ved") kmume)s add mes= Kuma 4nume- Sub mes = Homa - Dome; mul _ mes = NEMA * ume; ives = NUMMYnume 5 modiv mes = numd'le nume Fay -mes= Celoat) numyrums! Print t CS \n fed 70 d2%4num a | sunt adeh_sred), Pouatt Co An ted -Yedixdnuma | nume, sub-28), Paik ECS \n nd * 7. domuma , num2, mul! sw), Pount On ted Jd = ee), numa, ume, idiv faa): Print t (\n7.d Yond = fod” Nut, nume, modiy sues): Pairk CAm nd fad = %-265 numt, num, tdivemes): alton oy a 3 Scanned with CamScanner 6 - Output Enter tae VS numbers 4 Enter th end aumben . 4 Ax Tale 9-428 A*4 263 ala =\ Ahr ee Va =e le et 2 cligts abla eCrmoh rei) Exe: boss a pouftem fo sulknak & lon inkegey # indudh int main ¢ 9 L Loney ink num =(23kSe7, NUMe ,cdiH=0; cliscw¢ 25 Pour CY \n enter the numbers”), Scant Ch ved", & numa), AiKE = oum a —mume; Paunke Co Wn Diteaene = ad) Ait); areluan 0; 3 Output Enver the Numbers 1234 bDilkenene = 1233333 Scanned with CamScanner 6 ee Pawog © le show Le ve ot au lalonal gpercilox oe # rncludk estdio b> ink maine) b ink y 210, y =205 Poinke CX\n pd e nde WA", HY KEY % Pounyt CS \n id = Reae oY he); Pont CO \n edb dend’, Xe, *12Y)5 Pointe (And > aA Pont Co \nrd 7= “dd Ponte CS \a inden nd ah aehon 0; Output lo 20 =0 lo > =20 =0 loe= 20 =\ sa Condition aa Fauve, aesutte ill bet othanaie 0} Ka: pel th gulpuk don te oe poapuorn. # toclude ink main ¢) ! int num=3; Printt (8 \n The value of num = hd’, num); Panké (° \n The Value of ++ num =n", ++num)- pour (8 \n The nen value oF num = ted", nun), pouakt (8 \n The value ol num = 4d" num), Scanned with CamScanner

You might also like