0% found this document useful (0 votes)
4 views16 pages

DS Practice Questions

The document consists of various programming exercises and code snippets primarily written in C. It covers topics such as input/output operations, variable declarations, arithmetic operations, control structures, and functions. The exercises aim to practice basic programming concepts and logic through simple tasks and calculations.
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)
4 views16 pages

DS Practice Questions

The document consists of various programming exercises and code snippets primarily written in C. It covers topics such as input/output operations, variable declarations, arithmetic operations, control structures, and functions. The exercises aim to practice basic programming concepts and logic through simple tasks and calculations.
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/ 16
oe Practice Questions :- on ‘include j piin(C* Nome: datam-R, Fednsini\n*)s printtC Age +19) 9, Pint (* Gllege : army. -6W\n), | — getumn 0; . | 3 | do ic. ¥ | PS Gloxt the prguaro 7 Disphy gous nar Using point ctolonert | CMP ky our age. usieg printf sclaleraeal | > Viply (our cal using printf clotement > Grd the pu ear @ 4indude int maine> nM “rinl{C* Welere t Programming) 5); telum 0: \ i dig — Stor! the Progeaam > Diglay “Kleleome fo ¢. a dM’; PlinH(* tnt=hd|n?.g) : PI yg « Zf 02 bd PUOH cable - ASH \n? Os PUTEC chay
Stort the mM 1 ‘ Declare veniabk a of Frnlegey type and initialize a Value Declare variable b of Aoai type and inthalixe b vabue Delare veaiable c. of double and initaliz c value. —Zrelexe variable df of chav Gnd. inttiolixe cl value... Disply att the values ob od using printt chiemert > Gd of te pregremn i @) +tincludezstdio.h> int mance? Tal axe, lng buch Print$C* Grey length: [ns Scant (“Yc", Klength); Pan (* Grter breadth »}n.); econ (cl, & bead) area > dength * breadth: prt t(" “Ahea ol the Jelogles dlp” ine)’ yelum Or - 3 \ ‘a : ZF Glorl the pr ra) —7 Daclare a variable aren, th and breodth ‘ Read value of length on 8 di uKing, cand sires > @uldle > angen: Deeply the value 0) intl func SOR gen Sy ee © +Hindudeceldio.n> afi 4 auloy a iy inl moinc 2 Pak abilemp , ted wea ah ol PiintEC*Grler value of a z Soom (hd? 6); Piinl{C*Grler value of b:* »,; Scarf (hd, Lb); tomp=0; jacos aac a-b; . b= temp ; Pink C* After swopping:\n")s pintCas hal O pum b- ‘hd \o”, Bs, q wel SSS oy IS = sei the ps syne vero, ub and ; see mia ob bly ceanl tron Slat omd check venp-a; ab: b- ‘emp an ini play te valu a ae b afer cxnpphg wag Prinky Yori the program Bindhecslohs li tl Maine > : int abc; | av 5 PiinlfC*Grler the value of a:\n): Scat (id Bed) Pir Gite -the value of bs \n)s Scarf C4" 4b); Print Grley the value olc: bo Stoml (*/. 4°, 5: Avernge = CorbsO)s ' Printt (Average ol tee numbere : Lf)’, auenge) 5 yetun 03 . 3 FeGlort the pregram Spelane Verh a,b,c of Inneger type ond average of log “tape abe RO 4he Values abc ting scant -fendion . _> Gleulale » aueroge = (atb+é)] Display , ~Fhevage by uling Paictt function > Gd the Program . sina @ +#irdude GP OY Gmpb Drlersd wing pr 7 the Progam Sa int ede Glart the Program rr owe Geile -to0 Voriables F¢ of load , pe “Rod the value of ¢ by aaing seantes sunction @rd store the Value mc > Qleutate the logic, Fe CormSi3a.. Display the temporckre iF valich wns caleulaleg | —> End the Progzam =I @tnolude (nk mained \ Int nuns . Dil (~ Giter dumber: \n®) 5. Seonrt ("7.0 knuvh) } a if} (num 4a==6) IMETL™ AA is even \n® puns) * py @ Sa Cake is odd PP num); vel 0 3 on ‘ a the peer : > Fredle ~the numbey 4 ea. . Rod. the Value oh an a aenk (9 “tition « : AB) wig H condition, chuck Meumo a=) HW ae ~bue, print the Number ig even. At tf is alse, pint the numbey 4 odd . a -7 fd the Prognarn © +Finlludecetdin.h > int mained Tint Nun ; Print C* Clery number s}n¥)s sant (hd, xnuxi)s Ma) caronth eine if(numss) printh( Number fo Positive |’) ; ebeit Cnum<6) print( Numbey ic Degotive [nds eke PinC*Numbe ig egal to Zex0\n 5 Yelm 0; 3 Slant the 7 ann Sl veo number of inter a 7 Junie >? th Volue ol Number using i Guns Hn a SS SdINg UP he condition, chedk i Cn Newbee . "T i Fa ac antlher cindition ebaeit Crum) i i “Nurrbey ‘egal, Dat is Tahe, pind Nuun, ts hh. zen": ~ Ga te pol it Int Gg s=1 Drink co Aligible for diving license {n')s eae painkf C* Not eligible fy diving license 0°93 ebuin o-, 7 Hook the proguann ' > Declare \emiable age of ineges type Rod the value of age wsing ante? function a Check A condition , (age scig). Teil is Hue - Print “Eligible fr dining Gcense” sda leer * > B it We Loe, pink “nud eligible for drniing certo > Gd te Pragrom ntl @s¥mcuudecstdioh > . ink maine? cay ge ahha fint absolange y prinll CGrler the values of a,b,c:\n")s cant (“hd tdi)d, 20, Xb W Cassh RKa2=e _ Pant! C“Lapqed Value is “a\n'), 1°" dseit (b>-a 29 be=e) wey prindl (Largest Value is! yp’) 5 else pint (* est Value is c)n)5 yetuyn ms ‘| ® 5 slogic _ \\« —> Start the progeam >Detlore Variables abe ef inokaer Hype - Oreck H(a>=b DYo>=6) Pt it ic. tue, print oloxgest Value ‘tc a it ic fake, check elser} condition > Check elseif (b>= ask br=). PER & cue, print norgeat Value js b". PE it is Toke, check ele condition - 3 int 1 value 7. Dlink “doages uv is ¢ i Meldecel h> ine > 5 b Dy chores L \ * Prine Gum » brenk 7 re a; fac Gbbod 3 y.4)0”, a-b)s ie bya eal pc Muttioly ; Ad |n?, ab) 5 Cre He Hb) o> Print ( *Quotend + yelp? ab); ele PHnLEC" Com not divide y o|d; break + ‘hd|n”, ib): Care 3; gue PantlC “Puaid Aiba: gles Or. 5 Ao ic * ZZ Gort the P*egpan + Decor’ Werriobles a,b, choice of integer ope nu | 7 Ret the Values of ob cuir ean! cReretion Pan 1 Dag 2.Subbract 3 Mubiply MBiuileré “Cue | our choice ain Tr men - ; ae Value a te ae cseard fancton By W5Ing SUHCD Clade | DT choie is 1, hen Print Gn? A) break *?E chote fg 2 then Print “Sublract * 4 break MR, Gee is 3. then prind “ Matyoly eae + Chie 18 4, tem dhek FCB Ee Te ctr, pint “Quotient” . 5} ah is folie, print °Gnnot divide hyo! @nd break . Py defo ctotement, prinl ~Bhvobidl choice *. Gd te prgram. O wirdude “ink meinc> ¢ ede Ty tor Cink Tels 1c loo Print (par, 1): Tew o 7 3 MD) is el “ - i “yu “SOUS Se. Stor th Dionan | ig bp TP tumbias Rom Ife 100 wiley “0 iol the se int Fe tstestwos 14D bang thin tp “ate Uy; Sy eta he 3 “dine 5 ‘ in Mists Pinte crea, & nowber::%); i ‘ Seong Cs). 49,25; Ay a : ( Sie Cie st) * ny ' . Dae Prin ow yg Pid\o®, DyntDe i ie wp als TeUwIN y+ ee che Program ; > Dedore Vetobles on and f=. ~?Fod the Value at vsing Oy, Maine > a n, Sum =o: Print (“ ee Soi Cint i=t Gecy - uD Sum =)) PrN Sash = hap, Sur) + ay be a “ Lal the > Deore 1 an initabize sux:0. 7 Rod Ihe Value o} 5 Wing ean} fonction .: i ‘ > By using “for leap, ter Gn tots e035 Tet) and cla cum t=t 7 Fink surn = €nd the program ® sincude int main ra Int num, coun} = 202 GQ PInHC “Ger a nanber :9 5); on td, Lnush) 5 Toot 4 +5 Dum] = Ip, While Crum) =5) « , Png Chm Af aie: yd)? Jp”, (ound) . phon y * Bhe S Stand orl thy | CDI 0. i oe ais cand Faveton 7 Ping do-whib pop, do combi ¢ Num /310 oy while mp théle (num) 6). ¢ print Number of 1 iit @ ” Pay inna h> mt Mancd % It up eyed; Print. ¢ ‘Gales: arumber : oC Bonn oiler: 20) Toye Fev Num, tox g um/=R; PHC Rcreed umber: hd n%sres), Tetum 9+ miner ied we wit 34 » dogic *- . Gnd the prograro -7Devlve num” oxrd Anitialige FN =D . >Rod the Valuo o} num Ui econ shncton > By oaing while loop, while Crum) =0) FF TEENT eee ' “_sQleuldle ey = yev? n4 hum Joi +, urn) =10 em pm * “Ruyoxed number” : -> &rd the Povspran (Datindude fmt Moinc> at hum,7> ignime =h3 Pn ( *Grler a numbers); ecto (ed nun) 3 H(num break», 4 5 FF Clgprimé a Ci nurmbex \p)s Not O pire number \n9) ; Agie > Grav the Progs ar Nan >Doclito num, 7 and “mnitfiols Ye leprime Rod the wodue of nun using pian a 1+ (num IM Manes Fain fetsicsn AD 3 SorCimt jos j < 254d Point C* +, ( panti(jo9: 4 Yelum 0% 4 > Sloot he prygrarn . hb pant Pyramid . ed 4 “| : + * 2 yt ar , Ofter fhe, enlev. and >be “fo Loup , fv (ink bas 1k24; Hd) | inks mother or bop , brink jet age i pead {Then print" aind pint “yor 7 Gd the jam.’ c a

You might also like