Professional Documents
Culture Documents
thonPr
ogr
ammi
ngExer
cises
Ar
ray
s
1.Thedai l
ymaxi mum temper at
ur erecordedin10ci ti
esduringthemont hofMar ch
(all31days)hav ebeent abulatedint heform ofanar rayinwhi chthef ir
strow
denotesthet emperatur
erecor dedatthe10ci ti
esonMar ch1,thesecondr owf or
Mar ch2,andsoon.Wr i
teapr ogram t oreadt hetableelement sintoat wo-
dimensionalarraytemperatur
e,andt ofindthecityanddaycor respondingtothe
(a) the highest temperatur
e and ( b) the lowest temper atur
e.[ Hint:Use
dicti
onari
estodi spl
aythenamesoft heci t
iesi
nt heresul
t].
2.Thef
oll
owi
ngsetofnumber
sispopul
arl
yknownasPascal
’
str
iangl
e.
1
11
12 1
13 3 1
14 6 4 1
1 5 10 105 1
…………
Ifwedenot er owsbyiandcol umnbyj ,thenanyelement(
excepttheboundary
element s)inthet riangleisgi
venby
Pi,
j=P i
-1,
j1+P
- i
-1,j
Wr it
eapr ogram ( usingarray
)tocal
cul
atetheelement
softhePascalt
riangl
efor10
rowsandpr i
ntt her esul
ts.
Attheendoft
hepr
ogr
am,
youmustaskwhet
hert
heuserwoul
dli
ket
obookanot
her
ti
cket
.
-
--
--
--
--
--
-