0% found this document useful (0 votes)
52 views28 pages

Dec 13, Doc 1

Uploaded by

ayushdevadiga0
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)
52 views28 pages

Dec 13, Doc 1

Uploaded by

ayushdevadiga0
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
You are on page 1/ 28
eect iG * Repave Flowchart , Write algorithm and -then carite a program +o perform the mathematical operations Goth as addition, cobtraction _mutHplicat fon , division and mod of 4wo. numbeys- > | Flowchart i A Toa Ba a. | Now, Ids write a simple algeritam + Ht Stayt dae Program. ea = IX Jnput two norabeys.,.Nuent and. Merde 12 choos, a Matiematical operation. oe (addition , duiotraction, MolHplication.,. diviston_or.mod). { . Pirtorm the aclecled operation. haseel on the user's clute, Display the veut. | tsa basic ¢ pregvam Rens: this 0 es include < stliohe = a euble ue imum eet Priaté C fntey frat nombevi "Ji Seand (" eff", & nm 1); _ 3 z pe Print f (“Enter secound mumbey "Jj ant ( VIE", & nome) oe Printt (" choose operation (+, canf (“sfec”, & operation) i Case St! 2 ue Yesult = num 1 + Num 2 j. brea le} vesolt= num ts = num 2; brea ie 3 é onnes ere Yesulk> num 4 x num2; byeals ; gabe 2: t£ Crom 2 t= OE FOR EDUCATIONAL USE tt ss Yesult = num | / nom 2. ; ee ete = al ES Ec a ee a Print#: ("Error : Division by zero! \n" Jj | veto J; Ss : | Beis | byeale | Case ‘*lo': i£ (nem 2120) ¢ ple Yesult = (tat) nom4 Yo Cint) num 25 a dlacd, | Printé Céwor! Modulus by zero !\n")j | Yetorn 25 ie ois break 5 Z oe default i : i Printt (“Errors jnoa til operation | \n"); | _Yeluvn 2; sR EDUCATIONAL USK ie Wilt a. _pyogvam.. +o. Find 9 alk omoug nel | }_ __3 numbers using if statements t include = num) &a Num2 >= ees YOR EDUCATIONAL USE ~~ Writt a program to find smatieat among the 3 members sing conditional operators: He include ‘ ee Int_main¢) Int nem 1, nem 2, num 35 smaltat ; Peintt C" Enter three numbers "5. Seanf C" sleet lod too", & nomi .rhum 2, 8 num3); | Write a. program to input a chavacter. andl oleecole whether {+ is a0 vowel or not+ “Ivy to use o._vpper CD | Case of the vowelr-— Jnrluge [oy to lower () functHton -to fgnove the chavactey Stanf (“ yc" vy == ‘i' I) lowevcare chay == ‘o' I] os £ & Chavactev )5 Le oo Wbeivenecher ee K | Write a. Prosyam_ a Find factorial of ead oo tne uate i fo oe fe Scant (“+Jod", & num); oe eel ieee ifGiom cole = fi anette orga ee a ie embers Sn" )p 3 4 ae os os elsef fe | ov Cnt tog ie num 241) a £ Be eee pee a : 4 _Yetwrn Of |i FOR EDUCATIONAL USE Kl Weide a progvam to input name_anol_ mars of 3. Sobjecls. Calestate otal, Percentage anol oS —Shaolenta Seen to the Slabs see oe : if ete oad ioe : hs Hint main.c>. ae ie Bee M | ei Game in a Ae Prince C" Enter hud eos eae ee Seant (“ fos", name); Print t ("Enter mark oe ea ee Gant ("7t" A movies Lol )i : ce _Printf C\ Enter movies for gubseck 2 Sunt dh!) 8 maven £1): oe | Print (Enter mavics for gubyect 32); 4d Seanft C's 4 2 mavics £21); FOR EDUCATIONAL USE Le ie | total» mavies Lo] + mati J. 4_martes rears é ieCPeeninge i 44 panning <8 gee tec if (Peveontage >> 60 22 Perentag j | Percentage ec(Cippal feo) se Es el _gvade = ss sei A Goce Cee pg colt 1 - 2 oes i BvadsleeuGi Ss | y | else ee Ss oo BR ee HE include Int gednm Cy £ ff lode oe Print (Séntey a_numbe ] | —Seant C% pool" 8 num} eg ti 4 Soe es ae sony int vevevse Cint nym) = Ve vt yrvevsed © 07 2 2 | __while (nvm >0)f a ——_Yeversed = yeversed 3 10 +num 10 101 2 hong) (tot n_veveysed jf aint main. oe tntnum = Getnom 4 uel £ Dine C8 fool is. a palindran: va Ean pa S i ee es, | 4 oe d vetorn Oj. Write tea 0. payin de Bl Boral ae a. each a : int main of L oes ink z sg Print O" Coser, cant (" foc" g ee Ya_hon- negative indeger "Ji . Lit Cnom co)f # | Write ag _menv_olviven prog) = Lorvay dlisplay i+, dh ca cveate one olimensional wd the som ofa the element, ad“ maximene and minietm element ovbthdn Hee overs — __[Linclode se faci _|_ Seve the ayve Weil creak Avvay Cink arel 1, inten £ —___— Print ChEnter Yoo elements Nn" ni De Cnt t Bulent geht nn element: Finally | — Seant-Cvtol ” , & arr [i]; Lg | void di vray Cint avy £1, nen) d Print tC" Array 2 ")i ao oe tov (int tz oj jen et DL a; a | Prine Cro", avy CiD) ei SS 2 Ponte (An) se a 3 whet. int Zum = 04. _ ey (int (20s ign; +tid oii a ee . Zoo pe Or fi Yttorn__ fom j _int find Maximum fe ow C1 i int Max pee - _foy Cink § én it Carr Lil Sy max. pos ea ae Yelurn maxis [ink mins arr Co for (int fe1 : feni +40¥ if Cary [i] < min) £ : aes min = arr (ii rl 3 zo 3 ue) yelorn mini int Search Crment- C int_arr (1, Intn ink tary Et | foe Gnd in, len) SG oe ifCary Li] == target) L_ : Se y¥eturn 1} Since Eee So vere Sorthrevay Cink ary £1, intn) toy (int iso hae __ for Cink je 0+ Te hye ie SE aw (55). fee = By £@ late the coeier ae the eve, 2) : _ Scant C'sed", &n)i ae ue ees Paine ae Gols ee IU RNA ei GE Se ee a es Pog C8 eke Aa _ Printf# (2. Display Array an); a is Printt ("3. Sum of Elements \n Printt ('4. maximonm Elements )n') a | FOR EDUCATIONAL USE | Pett C1. Sort Array \n")i | Pte Olas Exit an) matt ("Entey owe clas eo = ed ed Printt ("S. Minimem €lemenb Wn") 5 Printt(6. Search Elemen® \ni— Case £2 ox cate Array (my fay A i byewles ie es Case 2: Re 2 clisplay Avra bone Hie | brea le 4 — Case 3 pe Print ("sem of elements: nd ln, Somof elemenb | de = Gay Array nj Sok bveales = Be Case Yt Print (maxim to dint Poe a (ag Arvay .n)}i ee byeale Cane 5: case 61 ee int target Printe ON Enter the clement to scare santl sled", & target yi | _deintt (Element fovnal fo. 5\n! target)? = “yes” i chek 5 i Gast: ty z oe Ayva hinds ae Bt “Exiting the on Side De! me C __Yehorin 0; ead poe Aare ‘ie Pent (+ Smid chee Phat as. ge Es FOR EDUCATIONAL USE oid creat matrix Cint rows, int cols, intMatix Crows] feels) )L |- | Print£ ( Eniev the element of the matrix* ee ee oe IIe Write a Progvam +o creat two arvays, find sem and diffevence of these -kuo matrices: 3s Ht incledle wii a _ toy (int jz 0) jecols ++i)d nt Centey element at Position (led, “ool ttt St t)i de oe a __ for (intj2 0; jects g vows peti Foy (int j2 0; Jécols, ++J)G pe ee oe Prine ("ted \¢", mabix LCi); os a Pontt (yn 3 lvotd sommahix (int rows, intcols, intmahix1l res) [ols] aa Inte mabix 2 [rows] [cols] , int voicl displaymatyi x Lintvows, jnteols,, intmabix Lows) [ols L | So Yesute [rows] cots] )E_ 5 tt0L FOR EDUCATIONAL USE es for(int izo, jd cols j t4s) 4 I void didtmanix (intros isto Die )ees] i ——}— a Goepabiy [soins] heal I], int resoit-Lows)fcotsI)t | __fov (int i= 0 Oi ierows eel) Gas 1 __foy Cint jz 0} jevols | +1) + Yesetel ]LiJ= matix 2LiILi1é mebix Panraits : = 1 : g a 2 ZB 4 Be 4 : Lint main OF eee S fe Rotem cole eg ean es Scant (“shool", 2 vows) a Printt (“Entcv +e nomber of Colomns 2!) 5 Stan£ (% doc", & ols); Int max 10 vows) (cols [mater 2 £ rows} [ols] ee aL diferett | s] Leolat;_ Bie ie manis Le catemabix Crows, Cols, matrx 2): ee display matvix (yous, cols, somberolt); oe Pant (On lah ni dinky, EN Soi i vo ee ae ee Resoit Ji ps | Print ("\n Som of the | cing ip “Tis nc ditteen sit) —_}— | Prntt (An Diflvence of the matyices 2s" one TL dspleymatrix vous, Cols, diffRersott); dt Yetorn oO: = is | Write 2 program using the Concept oF Otvay Of _ ___}} Sheeler do _creott ot Uist of shvdents having | — the Following FAietds , vollno, name, mavies £37, totaly. |— | Marks shovld by storesl ay integer avvay sf _2 |4tinclode cetdious . : L Strect student — i s ee ie i 4 ge 2 ee ae int voll no; eZ | chav name [50] ; tesserae ee ink _mavks [3] 5 | int dotal ; z os di ee in+ main ¢) aes le Struck srodent siudends [5] ) a8 fev (int §2 0; feo, ited Printt (“Entry cletails soy student hd i\ Print f (Rot! por) i Seant (" fod", 2% Studenb ce “yo ‘ou nods i+ Ds Print (“ames”); a Seant Cons! stodents Li]. name) q Print £(" Babe Pray fov thet Sobjects i\n"); ae fe Gene 2s < bi ld Streends Li]. marks [i]); | (42 stoolenty [i] I. tote Se Pett E Cnn ys EIS PRE Sodend his sulle oe Gniibeg sie toe i 2 See Prinkt C" Ron mot led, Mam _ 7 re |hviie a progam -lo create dct tle LL, tee! which Stoves a line of text HU Ant. vsev presses J the cniey.. Copy nis file Into uw hb des >| deinclude —— Lint main c) File * file 1, 4 tiers _ Chay. Line Lice] 5 — ttle = open C818 vbxt Swe") it (Biles 22 seen £ —Priatt (' érvov opening Atle L2. txts"); veto 1 | ee ele ile Se eae ee Pulat£ (Entey a Line of text (Prer enter to finish): ile C£geb Cine , size of (Linc). dtoin) 12 MeL 2.2 Line close (file 4); — 12 fopen FOR EDUCATIONAL USE. Jf Chile 22 nu) woes Pratt (S€rov opening file £1 «4xd-\n! aah ale ‘ Ythurn 1; seca ae Fil 2: fopen Cla ctxt aa") if (tile 2 22 Nuec)h zs Matt CS Ewer opening file L2.txt \n'') 7 Yeturn 4+ (facts (line , size of Citac), Cetler) teyint (Hite 2, "les", line) 4 ___ falose Cane 1)5 __ ftlose (Fite 2);

You might also like