You are on page 1of 9

0.

Di/feent tenol StoemenH in C Longuage


Ans: Ln C, tonhoi fons from one inshuthon t0 the nezt
nshuthon . his tontol tHow fso m one ommo to
he net Ps colleod squenh0l tonno) Hon. t SupporH
on untondiioro Jed o bron ching Jtotemen thot onifr
he ton ol to on0ther loto hon in the po0grom Delow
ore the tonol J+0tement in C.

I) Lf Statmenh
Lenables the rogrommey +0 cho0Je o s of
insuthons, bofed on o ondihon. when the Condihon
evoluoted o u , a se of insruthons will be eietuRed
ond diffuet s of instrutons will be execwed whin the
Londhon Ps ovolugted t0 fo Ise. fulthth, it has 4 ypes.
o) Lf.- else
b)NOJted
)Else P Loddor
d) Simpl if or null else
e) Mull ele or hmpe elst

Swinh Satemen:
Chas o mulh-way Jelecbon t0tement Coled the
Swith stateme tha s easy to undustond te resee
ano 0ltenohve t0 i otem enk. The om mond sw'thes
behwun the blotAJ baJed on the expresnon volw. Eoch

bloC wi hove a tonespondy volue.


Swich (eLpregin)

lose label L
ShEr men} [s)

Shanmen)U)

defoul:
SPO men(S)
brak

1) Condiiona) opero tor Jto Nmen ond


stottmenH
L T 0lounohve Short hond of ff
Con be WIithn in o hngle ine.
ezprRshn2
Jynoi: (londih0n) 9onpoeSSons:
londihon Ps volid.

s eeund w hen the i


Epresnon L the
Sorëmeni

2 w}) be e1ecuted if
Then exprsion

in Lorrec.
V) Goto S10nmen
GotO JHO omonHPs for jumpi ng twnho)
known
JtonmenH L 8 used 0 toonsjer the conol of the progom
Ps Used
om one blocn to anothey bloK.goto reyword
to declore the got6 Stohment.

Synto 9ot6 lobel no me;

abel nome;
n above Syna7, the g0t0 wil ponjjey the onol of
the o Yom to the tobel nome

0) For Lo0p:
Here, the Inifoligonon JHat menl execue d only
one hme ond af thut the ondinon f cheuled the
rosut o ondinonn fstu it will ezeuue the loop. t
fOlse, then for lo0) 15 U}mnotid. Howeves, th resui o4
CDndi non evoluo ion Ys duo, sONmend inside the bdy
body ofof
f0v lcop 9eH e7ed,9 the 01presonIS upoUed. whpn th
ondihon fobe, tht toop tumironp.

Syn01 foT (iniholisonon St0kmen, coodihon)


Sremunh inhde loop
bwhile loop:
Pn t, the while loop s a guwded enny vop. The body
Of the whill loops iS only performed if ¥he tonoi hon
volid. Th loop shuenre snol exeturgd if the tondinon
Slors +0 intovreCi

Syntod while (toodihon)

SHNminH injidt the loop

Do while loop:
Unlra whi l0 loop, the
body of the do i^the diffetunu
behweun while ond.while l0op P guoronned te be done
onu at a hmt

Synte
0 4
I) S-OemenH inidt the l0oD
while (bn dHon) ;
Wrin a progrum Hadd, mulbply tmO maiu Unn funton
ond without funChon .

Hinclude (Shdio. h)
VOid
musply (iat-moH{t2}{/2}, int met2f124fn3, intrirt,int);
Vofd odd (A
Void maun ()
int matlin(02), moj| {Vnjf2J;
Pnt i,j, k,m,
n.p;
pmniy("Entey tht number y TOWg (ols for S'mort\n)
SConf("7.d'hd,gm,gn)
pn[ "tntYr tht elements of the 1J1 muhiX \n");
fOr (i-0,i(m;itH)
tor [j-0:j(n:j t)
Sconf ("y.d", {matLfi1sj)),

pri f"ntr the number of to1S for 2d mamt\n'))


Stonf .d",sp)
prinH"entey tht elermen H of the 2d muix \n);
or (:0; i(n;i++)
1 4o1(j-0j<P ;jtr)
Son4("1.8', mad 2[Ý);
prinH"ht 1Jt muhid\n"),
forti:0;ikm;i++)
1 for
lj-0% jensj +r)
priny%.dit", mot?lijij);
phin ('hn");

int mut]f/nj,JumSn312);
WSHOrt mulhp)ying for two mohils

Or (-0,1m,i*+)
1
for (j-0j 4D,j*+)

mulS) mujtiðh7 +mo!i31*]*ma 2{r3(j]i

Qdoling hwo matmJ

for ir-0, icm;ti)f


for (i-0;J«p; tH)
Sumsils1 mO!f i[j.]+matLf17U1;

pnthe r0JUIHanB moMi f0Tmed on muiiplyng


the wo mois \n")
1
for (-0j<P ijtt)
pi m4("7.d\P'. mu)fi)ij));
prini("\');
prim"\nsum of w0 momus: \ )
fo (r-0 1(m ++1)
to lj 0,j(p) +*j)5
inf(7.d", um fi}j);
prinf"\n\n");

Y
With Aunons
H include SHdio.h)
Void muh ply (int muHI12) S12] int mu 112]02), iMint,int):
Void add ( Ynt matLin) S12),int mal {i27f/2), ind,
VDid
VDid moun[) in.int)
int mu!in]tn],mw2Snn);
ind ij K, m,n.p;
Dvinif('oRr numbey of rows tol foy d mumy\n")
Sonf("y.d 7d", jm,sn),
p in " n e r the elemenH df tht ji möma \n'"
foi li-0,r m;itt) {f
for-0)jinij+t){
Swnf"1d", Smaj iSij)
pr' ny[ "EnRy the numtr dt tolumnj for nd moit \n");
SConf.d',faaLstt}% 4P)
prinf' tnRr the elemen of the 2nd mum1\p");
3for tf-0'%1¢n; f++)
forlj-0,j4pij++)
Swnft"7d", I mal?figj)%

multpy mall, mal2,m, n,p)


ocdd ( mat 1, mal 2, m, n, p)

Void muih ply [ Pni mui fn]fn], int ma 212]n), ind m,jnlm,i ndp)
1 int mul fn{n),ij.ti
for(-0, i(m; j+t)
for lj-0:jop:})
mli1i]0
for (0, K(n, K++)

rinu"he r0sult o4 muibplicuhon \n")


tor(1-0 i(m;itt)S
for l)-0) jzD 5) +5) {
pinf("%d\t", mul SIO),
psa(")
matLSn)tn3, in mad2(/2)Ni), Înd m, int n, intp)
Voio gd (int
int sum 'n){n],i,j, t
Il oddi'ng wo mud
for(-0,i(m) +ti) {

for(]-0,<Pi+*j){
dumfi)ij) mtultSi3J]+mayz{i)tj];
'Uf[\n Jum of wo mghnus: \n");
for (10 i(m , +ti)
for (j-0 nj)
j<9;
1pintfny.d", umir])5
i (t-)
prinuf ("n\n");
3

You might also like