0% found this document useful (0 votes)
45 views

C Programming1

Uploaded by

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

C Programming1

Uploaded by

pankaj1017k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Tsogom Boponina ekos to a

*eling a
n crdey to
tedrolgi
Cormte cich
oe poblern. you con
take o
focegs
te
PrCogomng
Computer. t think
coleyedion beteen Hurron
Programing
Compudr Code, to the act o is deline as Act urtng
stheialngbernTelisn
royrems or. tehayi thathas
instilky.
*Clangge- Cis genead-
b Demis rgoming Jongge Czned
itchje at he tel abanar
om i92.3} iso yay
bolzsho ongungo despite bomg old.
to writezAnghy aödaled
the UNIX. saith UNLX, osit
Cangunge is a
Jonguoge- bach Comngnd in Cis aa header ile. encAm tosal
C-Pogm
Al Cormond
itsel is a denction
The
Tone nain (0.
ony om is iten in hus Jencun
Ihe popom o C-on be
ove ditesrt divickd io
hdo fouy bds icth
" Commert secton
decandion 3ection
donti}ies(idale) declzhn sedop.
Node
t3ed tor Comnerdn
Conmet secion
’ ge ne cormends.
2 Fle dechntin seotkn.
Syntc incite< headc ile ronai
stáb.h stondesd nt outft theadex e.
3. aendi4iotoicblea -
Varioble-,

yalid- @,28, To-.

data condol sting


4 Exeuteb scchion;

.
function Tomel"slotenent");
Emcin name:
Petrno.
fin hs is a endad indt
cutot emclon rome. inbst

#clude <stiot
Moml)
Pontt t"heslo");
Ren
3.
o;
Chaoches
#incluce< steio.h #incude <staio.h
int a,b t; # eo nclade<Conio-h
Yaid maimt)
yoid nam()
a 2o
b3o
J.

Congol b=lo,
5o.
C=+b:

PaansoerK
hecn o;
3.

endes the Auo


mambag
OF Wte
frogom that yend Yodius cick
kosbosd and that cirek
Gead 5xeal mo rom
Read

Solba)
Sol ond Uabby met
Yent+eny
ens ooloocnce)o . goly (acm e) oyt hese
colasae Cnd dupkybokcttotalondomoud.
price ay hat aobct
GS> Red qund a
ouct, okt and ice oj hat
cadcualeQmand.
1S,
loddesilio.h
1Sox2o Netse Bal +dthy

lot aHeg

wainy
4Toe

d
"ea)

?
Jeteh
mcse< sfeiot
ncudecConioh>

cJys);
rn ("endcs the odiu-)
Son,);
ayea 3 14XX8,

pint}Orco);
3.
Consle:>
ender the oiog3
2806, 18344/
8z44/
#
Irdude 1stiot
Void
man()
#mdudestioto
Salav,adndsolag
maum

iny ("sobrg")"
d= oix125/tbo)
)
3.

Consolezaong'
nta=24000,
# jncludo onlo.h
Jbat qy, fore, ondt,da, laatt
15-o7-20)3
Bonch Sktment:- In Clongucge thore is thoee
aanch lodements
1. i)- else 2. Suitch 3.?: Conditional
" else- Hhe il statesment opesat).
allows es to þutBome
decision mking into ouÝ regorms . The
gncgal Jom ifstatemenis: -
i} (Coraition)
4 the condition is SBatemet.
wil te executed. tue(Tienzeo),
the
the stateonet toil not comiion
the gtatenent
is
be exeuted. TheJalse (o),
optonal
ás Jail.
clase, it cil e
erecute when Condicnelse is
Synta
i.}(Condition) 2. 14 londifon)
sddemerd' Glelseelemend X 3(Cndi)
saenend ; sdalemert:
stelheaBtmedt' Bcemendt
Stetemert:
3
sttemerd
3.

3.
shtened
l> Ljcad operados:

C.

Recd a letx ond


yowel chek aheth idg
an chek
ale
Date---23

48 ond ehe cpesato-This chextot comimes too


0. more
Conparisons jn a cones
nd t tue hen al comtisns are tie. y om
Combarisns becomes Jalse then it retnn alse,
} reicus eh. is tue then it ejl

Tuth saple

1
1
1

M=lo5,
1

35, P
l: n>o n20
int Q=
lo,,b=30, C= 4o,d=50, e; 1
b. I! ox 1-sto:
opexator:- This
in o cooxison ond
stoo

when emy Comxisometen oeoloigo


tecomes alse then 't seun
tueonp obro
teyicus exþ is. Jalse Ahen Jelse.
chedted. mot eh.
c! Not
oealer: This cpealoy
vEl thevocsse the
copoton.
t is a a
unay oead
#)ncudeotoh
# includee conioh>
yojd ran)

bin( enda adanc)


San(uzc", sh)'
che.
oint (" Corn3eron );
Dode>/o+/223.

stadement. The sith accept an exprcgion/


vogichle aind tet its lue ith the velues cwsiton
)th case. t amy coe ylue match toh the Value
soiteh oxxexion the statemet coith that cose
a>}l execte.
seak taderment wl tenda the
Condol cud tch-case. J} a case daes mat trek
stateents thm statermant mot cose oill
cxeCtde iU the byek statemat mot Jod g itth
does not ends.This, Awitth- con qnly det eert
ntding conbamg coith ntga and danctes.
abode caith Hocct nd

Scitch (ya)
Cose Valie:
statenend
tetemert;
bseck
satemerd
statement;
staBomert;
slate merdt

shederat;
#inclode
# mclude<conioh Kconibt
ehox
Vaid
h,
yod mun() mamu
cdsco) ypin}( "Enaa ca
tmt "Erdor a Nembe)'
stidh (h)
Soith(h%2),
casc. O:
a'
Even"); riqy
brek("Vcwel ")
dejault:

3.
ydeh (),
alelalion parle
paalon
Lote2/o|2-13.
Lop(3tetnox zekeitin)Cotols;- Loops cauge
toog an sto aute
tbck o oe
code eteatedly cmtl test
he cestin oogoomqring
Conidion is Jalse. Looh e csed in
The dsqp depends
kcefe isSbdemeqts. when conliticn pecome alle
Aerrimate.
2. do-hile.
1. bhile- lof- hie lootb is fae tstd Jop. tohae
cndton is jested and i tis te
tren stademeat il escudes -and qiven condition js
dsted and go o
Stnta
hile (Conditon)
statermat
whil Condiin)
shemet,
sheterment
ndemed;
-wne Aoop; Phe c. do-while gtetemen t
exectes as ong fecilied
the end e each tos thaaugh conition js tue o
the lop..
do
sodead:
sktement

ctilklcankikod:
lop. toy atetemert js any alid e stetenedt
Cond exp js on exesien thet is evakred at
the end each tos theugh the oap.
he vala1e he
(ie, Conpee cyucd to zo0) the Jop is euikcd
Since e CoTd exx is checked a the end
aloys ecuted at Jeng onee j cnd- &

Dieseneetoen wtile ond do utile


LThe do uhile looh execuds he eontet
he lo orre beloye checking the onlen
2. :your cndittn s at. the bgin the
Jop bloct, ond it coni ion become Jal!
Do bile: . yor conbon js at the ernd ot
loab block,on moes posgtble to rn
the loo at last ne tirme.

3. For loop:-The oy loot is knon os Contaed


loap. it tos thre ds imitializolon
Cendon. ond exegsien ncremet/ dezyemt) but
all the three ets cge
does me comBain.
L. 4( initicizatin; condi ion ; esyeen)
Bedemert:
2 er( inidabzatien; oniton; onþrewon)
shtmat:
3.

cwe on toe vale


votlables ho cll esed
a
yojd aim(1 clscx 0;

Pär"z4", e);
qckh0;

hide t ie> pincke stdio-h>


mcadecnio.h>
int a=1,m,
Vod ran)
chscro;
Pin ("Endex the nube:);
SCanyrd sn);
ohide tae=)

3.
Do-hide lob #ncdude <stiot>
# nclude <Conio
int a=
do

wile (i=n);
leht);
7
#nchinegtdio-t> 2.9
nt e, i,n;
yoid nain ()
chsco);
Pin("Ende the mear: ")
Scan ("%d",sh);

fon(n';
3

3.
Oolht:- Erex he rounx5
22
333
4444
5$555

includeesio-t>
CeincledelConib-h>
oid man)

=1; i(zn;it)
d+t)
12

dorli=i-];j>-,-)
Pony h", )
123432 1
234 54 321

3
geh);
3.
3|23

Ihtodeen- Aroy in C cn te dejind as

on thres imergicrs.

daa. n his ay all clamerde aongc in a


ineln) calm.

aheraicoad mott,
n this cnoy all elenerds anged n
mn Jinea(oa) ond may calm,
hoan. Srikedy, on angy must te declred belore it
sl. Dring dclntin, he aize
to shecijed he aroy tus
tg to

Inijalzaon t ary hWe con milalze he eder


s the orinart aray in the game cy
voriable aten dhey are dedared The
Anm initialin
arengd m'a gid- lke

68 53

Go 82 59
MS[le]
j6674| 4.o
oMS[2137 elmameemerk

Decbncn
too imngionl
Meeds to e
tyhe c doa js biny steyed n
the ateg.

Snstaüging-> nthe criey ctile tny the


J.e. we trowich alue

mt no[[3=,L1,2,225;
#incude cConibt>
nt n[lo],
Void i,um 0
main ()
Chscx);
pint ("cntex the no:");
er (j=o; js; i)

Surm)
qcleho;
3.

vod raln()
iK3; i+)
Prinp"ende theno:');

3.
geehO;

You might also like