Programmirg Concepts - Using C: La6 Fulanuaf
Programmirg Concepts - Using C: La6 Fulanuaf
FES
La6 fulanuaf
frndfE @t5 of qq.d6dc equationusingsritch @. geneEte pnntN Fiboacr numbeG and fnd Gco and Lcil of t'o iniageE [email protected] Int oer and che<t( whetherit is Palindrome or numb.6Pnre o. not5, Writec p@g6mto findwhethe. oivn be no6b.B.nd nndMern, variane,& St .da.d 6, Write P@qEm anput C to 7, w.ite c prc06m to readtwo matrrG a.d prtormaddition& subtracbon 2 of it ornot. a. write c prcgr5mto rdd. strlno.ndch.ckwhether is palindrome uslnq tunction. 9. WriteC prografr to ffndf.cto.lalola numbr
or L writec prcqEmto fnd if..rr.racter ls alph.btic Numeric special or 2 , writec poo6m to @mpute sumof oddandvennlmbe6 lsing fu.ctjon, the 3 . write c prcgam to fnd [email protected] noml of squ.E rEtrix ,sa.g tu.ctions wnte c prcqEmto.c@pta *nte.@and convert.lllowerc* to upper 6e
5 , wnte c pog6m to a@pt difEHt goodswith numhr,Fi@ and date of
pur.na*.nd display tno. 6. whte c pogEm to 6nd tne lsgth of . stnno with@t u5inqbuilt in tunction. wrfte c pdo6m to @pytn @nte.ts ol o.e file into anober WrjteC pogdm to di5play rc6e or a string uEno pointe6. tne
if(d>0)
1
pnntl ('Realand disllmt @ts ac "), x 1= C b + s qd(d)/) ( 2 * a ) ; x 2 = ( - b ' s q d ( d ) ) / ( 2 * a ) ; pnntf x l . 7.3f \n x 2 = % 7 1 ' , t r , x ? : . 3 c rcots are )i Prlntf eRepeated x 1= _b/(2* a); 12 = x 1 ; prlntf("x1& x2=%7.3f "I1,x2) i d = sqrt(abs(d))i tpaft = dl (2*6)i rpart = b/ (2*6); rootsae :'); Pdntfe@mplq pdntf cx1 = %7.3f + I % 7.3fl, rpart, toart )i pd.tfCx2 = %7.3f r % 7.3e,tPaGlpaft);
)
gtch0; Eturn;
i/
I.PUI a strlng Count the number of daEcte6 In a stttng lslng strlen function Dlvlde skin9 by two the lncement the first part by 1 and d*rement the next part fBm l.st by 1 Match chaE on eithersldetlll th cnter the If th chadcteB on elther sid match then th *nng b a pallndrcme lfnot, is not a palhdrcm Stop
*lnclnde<stdio.h> *lnclude<@nio,h> void maino char.trll0l; Int l,length; PrlntfCEntrthe strlns); Length=stnen{str); Fo(l-o; l<length/2;i++ )
{
r (.vll r= srrflength-1-il)
PnntfC%s ls nota palindFme',str),
Exito;
,
Ifthe n <= l displ6y nota ld Prlnt l. not a Prhe number El* ls a Pdmenumbr
stcho; exrto;
' '
lr(n%l = = 0)
{
Wrlt a C Fqtm to Inputa sdt6 ot dmber ard nnd th.Nrnen, v.,i.r, .ltni| rd d4tat on
int |, n; fl@t sd. 3!n=0Fuhsqr.0, mon. vatue,v.d.nc!=o, .l1ool; clM()j printt cEn.b no of d.r. potnr.r); $nf C96d",&n); prhtr Cqt . d.ta potnE')i n)r (-O; l<n' l++)
{
|En
Ente. dE moa&t
polnE:4
5 d : 4,5 3 2 1 1
Derfom addltonandsubt6ctlonof
Matrrx. an a@y ot numbFamnc.d h @ and@lunns l6hlo rs of 2, Re.d the elements matrlxA .nd .heck for the numbrot 6ws and of for of 3. R$d the elements matn! B.nd check the number bws and erEr 4. If numberof ws and.dumG doesnot natch then dlsplay 5. 6. 7. 3. If mrtches, then perfom .ddldon .nd subtEction Add natriia&a (slil = A[] + a[] ) subt6.t nafix a & B (olil = A[ll - a[] ) OBpl.y the $n slil and dliene D0l of t*o matriG.
bl 101 Inr.[10]t101, r0l [10 ] , s [ 1 0 ] t 1 0 l, d [ 1 0 ] 1i, l, n ;, pnmf center th orderot matdx"); snr ('e.d', ar); printf cEnte. tne elements rutrlx a "); of for (l=oj i<n; i++ ) ror(,=0;j<n;l++ ) s@nt C%d', &!liltjl); prr.tf ('Enter lements matrlx "); B the of lor {l=0; l<n; i++ ) ror(J =0i <n'l ++ ) J s@nf("%di &bttlul); for(l =0;l <n; l ++ ) ror (l=0; l<'; i++ )
{
t
) )
{ ) ,
Enterthe od.r ot M.t ir: 3 Enterthe elem.ntsor [atdx A t23456749 Ente.the demsts of natrlx B 234567690
( 3 s 71 9 11 13 1
1 15
1?
'i
I -1
L- r - 1 eJ
2. 3, 4, 5.
lnputa numDern = lnltlallzethe @unter 1r tact= 1 dlglts using filn 1to n Forloop counttie numberof fact Compute = fdct* I untili-n
*tndude<stdto.h> *rndude<@nlo.h>
{
n) lonsfactonal(lnt
{
Iab Prcgrams
to wnt a CSrogEm leredte ihe 1" tl
I
prinn {"Enterhd manv ths ? ");
ant write a c prc8Emto rqe an Inteer palindrome not or chdk wierher th nols
{
5. c.lculat@@'10+rcm 6. C.nnnuedlGel.ulation ontlith wholenoh rveue! 7. P.intthe t4r*d number 15 3. lt the r*n th. pnnt$'e numbr p6lind6ne el* not a palindEme
L |.p'n2ht gF.,!
lnplt a daFcter Comp.re the char.der wrth 'a!'z' and 'A4z' If matches, chaEcter15 then the qrven Alphabettc Conpare the ch.r.cter wlth 0 9 If matds, thn th. llwn chadct .ls l'lufienc Elslt is. sD.d.l.na6d6
pnr f cEnter..h.r..rer'); rl{(.h>=a' &ecn<-t ) (.h>='ri &e.n<= z')) pdntr lsan.lphabet"); CIt
,\ -/
1. hplt r 4d6 of nunb.6 2. R4d t E numb.6..d lnltLllr. @nt rto I 3. Olvlda Gi nuDb.r by 2 4. If th. rrhrlnder = 0 then .$En tn to 4n se.l.s 5. Il th. Em.lnde l- o oEn 4d9. in t tD odd.dl6 6. C.bLt tlE $m oaodtl .nd aq sl6 et ..By
ol th. llC
|nt l,6un-0,6um=o; io r 0 = 0 ; l< = n , l+ + ) r lr ! 1 9 6 2 = = 0 !m = 6un +.01; dm 6un +.fll; prhtr CSumor en nunbE l. prl.d('l{om o{ oddnumb.r! 15:
Enlarcldrent ln 6. llst L2345 sum of odd nunb.E 13 9 Sun ofeq Nmb.E t.6
rJ,n); rnt{101[1ol, Finu centerttE o(br oa enf c96d', &u; Flnd CEnt. tn. ebrcnts ol rutir
b. (l-O; l<n; l++ )
ealue of
+.trlUl..trtul;
and
)
(J'o; i<n; i++ ) 5nr 'or Crsd-,e!I0tjl); Int vold..rtun a[1o][to]. n) ont
{
I n tl, l, t 6 @ = 0 , s m ; lbr (rr0; l<=n; lr+) tl!.! - tEe +.Irl0l; td(l-0; r<=n;r++) t t 0 - o ; l< = n ; l+ + ) sh - $n +.Irtt 1. .!t0li = sqn ($m); 'gn rl|e pdr6 of dtrb. bi i6d', Crb.m or m.tn b: !46.2d-, 'lnl'
)
rr 23'\
1455 |
l70e I
i/ 6e.nd
to ...att
. aantce
nd @rct
all !,lE
t bsr
. . . .
I.put ! rtrlig i.d dE Lisdr or . inne tdit .lthn tu.do.r r'-'1ltrlll!.ffil!.lb!tF| lf ttE 3th9 nrdE tf ttu 3d4 mdE'rf - 2'n i,l b. dcr.d
otsrby d* 3tnr
to lGE.
lr (st4ll >- .'ai.t (ll <! '/) s{11=3r{ll-32; lr (!t(U >- 'rf ll st'llt <. 'z)
.rt(u.*{[+32;
) )
coNri.d
strrnl E hEro
Wrltea pog6m to .@pt dlfieEnt goodswlth nlBbr, pne,6nd puEh.* a.d dlsplaythem dateof
. . . .
date and price Aceptthe detallsofthesoodsllke.ode, nane, purchase Iniuallze. colnter to @!nt numberof goodsmorethanone tf the numberof goodsls lessthan the ounter valueac@ptthe detallsof Drsplay detallsIn . neatfom6t the
t
It charn6mel20l; st u.t date paydat;
,:
puth.sedate, prlce"); PnntffEnter ltemno,name, s6nf ("%d",&rten1.no); s6nr C%s",<enl.name)i p.yd.te dd, <em1 Albml.p6ydate, Sanf C%d%d%d', j <em!.payd*e.Yy) <eml.paydate,mm, sdnf C%s",altenl,r.te); Printf("ITEMDETAITS \N'); Pdntt "%d",lteml,no), c\n rtem.ode ('v rrm name Pdnrf '%5", ltenl.n6me); dd, date"%d%d%d', &itehl payd.te Prrnff purchdse 0\n yy); <enl,payd.te <em1.p6ydate,mm, Pnndc\.ltem prrce '%d", lteml,Fte)i l
'. r , . . '
lnput a strlng tntdall4 a @unterI, and lengthI Readth string using ushs getso Rd char by char by hcEmenilng th counterl=l+1 contlaue dll tlte end of sking Countthe numberofch66deB the DlsPlaY @unt.
a/
of d.
Fll. 13 colledon ol co.d5 ! To.opy the e!@ lll.l.to U dcdDtlon llle, both [email protected] dGdmdon fi16 m6t b. dEdng. If ddMdo. 6le d noa.x!a d.t
FILE.hrD, routft; .rEr h.m.[ls], ch; inb=lbr.ncd:\\sampl.C,'i), if (hlp- ULI) { pnnfcEm. h ot.ntno l
2. Select sou@ flte the 3. Opq the we nl.. a, I' nb sisB, op.n In ,ilte nEd. .b. dbd.y .n tu O!.. tlE <t .t|mdon nL dlspl.y a.emrmG*ge
a. copY t p
iL
9. nh 13 rc...3tult
@9red
whrl.(.hr=EoF)
{
fplbqch, dtb),
pd.U C$npL.c
.rr.r9.tc(inD);
l. ia6ftilly
Enter tlr. oG
f b Dm:
Ent r th. dGtrnatron lll.i Fll. dG not qist Ent6 dr ddtidod nb:
. . . . . .
Inplt. strlne fterc mnort loodon lbr ttE stnng clng F nteE tr.ad the st r.9 lilm tne b.grn.rno 6rno !ts0 to trnd tn |6stn Red the s|'hg fron b..rw'd5 tty &qll@ttng rh mmry l@t on by t PoCtbn c.ndnu. lndl th. .nd ol 3trl4 ls r6dpd filn eit rr slde. obpl6y the lenoth.nd the .4@ of t E sning
vord marno
{
st++; st --;
{
pnntf COnglEl strlng ls %3', str)t pnntf cRd.6ed strins ls %5i ra)j
]
t . ..t
Shuctued Programmi!g
M.le ltc Foalu's loaic<t to li.lalrdl by GiDs! sudl6 scq'E (srEish lid) $'lhE codiriGl (Bmhir8 ) srEre Rcrdit'@ (ldDoi) SaudE ll it t sll d.sig..d pdgl!|Mi.g rehnhE ro dd. sir., .Lbus (clEt 'a.d
Ds!r86 Eddiridl hE hirS [r. CtoTO,BRFAK !!d CONTINTE . . Clq & att !o 'bd.BLtrd
ModularProgramming
ItatSt d for v-y loogud cor@la Flst-s firc $ftE! dct kd.fl D.fd a brElio8 . Lr8. F!e@ iDto odl ird.?a.krt M.dul6 qlcd Pbgm Modul6 e oaui&d i. roFdou Erd EoduL Frforu r ryd. lll .!d fiulb, i3 Grcd *ith tb. Eir B@h Rrli ior Modrl+ . E .h tudul. dbold Fif(m u . . . Comsiqti@ b.r*q modulGt b 6y cdlilg ! hodul.. No co!|ruiotid @ r.r. pb& b.rc. ue.llcd nFdrle Atl bodul.' e <LsisD.d bw lo Sildcdcy ,!d Sincl. dit oaly
Arary
CollErio of Eld.d dd ofne B.hlvd liL bult-i! (||r! tyD. d.L tyF
Slruct|tl!
Cotlcri@ of dncd dd. of w dtu ttD. [email protected] fn ddrllwrE Ur.d io dcsign d.chF r rlructuEd oi
s.tchrd)
. . Thk nDcdonk Ed io @d sielc ctoFlar frlb lhe btut !d sta .
S.rctto
h u.d to Mcpt th d.t! sd
Sydloric Corutsnrs
Ce arpd eyrd* in in pregm blt befoEit is rcl.ftd in the?mere (n@,lly is de6ned h witt n in pilll lite6 It c@benoitfied fu al@Y Eg PI \alue @ benodified ,i.n ro 3.142 3.141 No Blaik spre bettr@ * ad # nust betle fiFr cheter. Th@ is a bl",k spee betwa @nslalt #dfift ed rhesymbolio TnesFbolic rme ihodd tur be Nirsled oy othrvalE within Eg:#deinePl 3-14159 {q:bfneSTRENGTE 100
Ml'gu/PEItr('..39rDtEti
Prepd6e. is a ptugm lhat pc6es ine sure codb.fc it psss t!rcueb l[e conpilqArc pl@ d in the$re ptug@ soue .od is ermioed for pEpl@sr di6tivs betue @npiling. IftheF @ dY, lppbpriai. a.tios e takd sd llo theprcgd is st ro Tneirerd&r is: dey bginin @lum oneod i3 not imimld Es:#irclude(spdifi.s ff16 to beincluded) (defc na@ sbnitutior) #de6nc *udf (uilefG a '@m)
. .
Is e .qu4lity or rclatiotal oP@tor D6 nol cbdep rhe valE ofth Eiable or the left bdd sidoI lhe Nigm@t st tenar
op@tor ihat Is d sigl|Mt 6sigG lhe 6uli.nr \he on rhe right h@d sideb rhe vdiable on Ch6g6 the val@ oftn YdiabL on tn bft hed sideofthe 6sig!En1 statmmt Port' iocrcrmt dffidot
-.
PE ilcrcbdt
d.dn@t
r- imov
amot
decm6ts rhe 6rst in@dtv val@by I dd [h ssierBlhe valre ro lhe vEiable oDthe bn
oeoo. I
Postietadt/ deM@l oPr.ff 6Ft sieN theElue ro 0F vdiabl onrhebn n nd side&d $d immaiJ d@dis tne
Eg int p,q;
The vd@ of D is fisl in@er d bY I trd thn val@ is ;siFed ro q, !lE ofq is 6