Durgesh Pandurang Dhore Date 05 April 2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

PPS Practical No3

CollegeIofode:- 20004026
DATE
O O O ® = Dete 05Le420-

aim ntQpnagmamto find qDeatts t


numbeng foom thmee uÚTN be IDS USing
f-else StcctementS

abiecties l o undenstand Contnol Statem.ents


m
2 oknoo hat 1S bn anching
Comma Stattments
aHoLo mmy typeS of if State-
mentsanethene
How to implement fStatem
fnt im amguag-

Iheanu n the fontmal flou faom one


nSaucHon t o the next inStmuction untl
mon in all pnogmamS: his ontn oL fiou
Comm.and t6 the next Is
Lauedsequential Contaa tloLD In most
pnngnamas thepnognammens may
oSKipinStnLdlons nepeat
O Set_of nStnudionS. napidly uhes
oithinglogicThis a n be. peffenedto aS
Sequential ConboalL floo The decdanatiams
n cet_pmngnammens make_ Such deci-
Sions whih Qme Called _decslon_makinq_
Contna dedlam ationS tis als.o Called
aS bnanching pnoanam_detides

which Statem.cnt to_execute based on the.


nesult_of the evaluated Condiión
PAGE
College 10-20ooy o26
Date) O5/04/202 DATE
O@OOS=
hepe QDe tuo types Of Conto o-
Statem.ents n hege ane-
ABnan china4 B looping9-
A Bman thin Lontno Statemenis
heSAattn entS thathelp us toJump
aom ane StakMent_ an othen 5tLate =_
menH uth_an Lojthollt Conditonis
Called BnanChing tatements Thes S-
aemertS qne aSO- alled as-Seie
cHon_StatementS Since theu- Selet So--
me_SAtem ents torn exeLLtion md Skip
Cthen StatementS These Statem.est S ame
a l s o Called a s decision maknqStatn=-
ents becauSe they- mqke decision based
on Some (ondihon_qnd Se lect Some_
StatnEN-LS- fon
Bnmhng Statments-mealsoOf
Hpes

Condihon.al nanching- Statenments


Un Candii.on.a Banchinq StgtementS.
Condiiona- Branchinq StqkmNS a-
The Stqtement S tha+_ help_us to
foom One_ jump-
Statenmen-tto qno
ement
These-Conditiona Bnancbing SBatements L
eqmples_qe
PAGE
College 10-20004 02G
WOWOOS=
Dgteo5/o4/202) DATEI

Simple-if Statements
ISe Statements
hested f else Statement
elSe i f ladden LonSaded Statm ent)
Switdh Case Statemn.ent

uncendiliona_ Bnanchinq Statements


TheStatemen+ that help us to Jump
mom on e Statemernt toanpth.en Sta-=
emeDt wthout any CondiHonsCMe
m Londitiona Bnm.ching Statementg-

Ezamples-
gotOStatement
bneak Statement
Continue SAatement-
netnn StatemeH-

B Loopinq Statements
me StatemeniSthat help us_to exeute
Sct of_Statemenis DePeatedly ODe(alled
as Lnoping.State0enis n cLoap Conbne
S+atanents- me USed to perDfonm_Loopin4
opnatonsuntil the given_Codition-
Lomes_ 0ut aftheloop
tnueConm ol
Statemnents on ce ondiHoD_bebecomestalse
lontmolStatments_
The types 0f Loop
in C ane_

PAGE
Colege I0-2ooo4026
Date 05/04/2021 DATE
MO®OOO=

altuhiie Statement
do uhile Statement
f o n _State

*lypeS of Onditional Bnan chinq


StatememtS-
Sinmple if Statements-
H1sone of the pouenful Conditlona
SEatement
ttStatenment S eSponsible
tun madifung he
PDOgnam. 1Statme0tiseualuaid
finst befone exeuting any- Stqteme nH
i n SidLe the bodyOf

Synta
1f (COnditlonL

Statemen 1-

Algonitbm
Sttp 1 StaDt.
Step mput A, B,
Sttp 31=If Az2Bqnd A
A 1S gnea-te.St Numben
=C_then-
Stp ' I f B2Aand B
B 1S qneatest
Chen.
nUmben
PAGE
Colege ID-20oo4026
Oc+e- 05/oG /202 DATE I

Gtep 5 J C2=A and Z R then S


eatest pum ben
Step6-atput_A/BLc_ is qmeatest numben
Sttp STop

Eloo chantE-

Stamt

Read thethnee
Dumhen s a s A A,C

NO TS A>-B2

NO NO
AC

ES
Yes-
PaintE pmint
CCC s the
e is the
9neateSt qneqtest CAiSthe
Numben"j geateSt
Numben '
NumbeD

(End
PAGE
Colege ID-200o4 02C
Dqte-o5/04/202 DATE.
OOO0=

I Pmoqn a m -

Ain dude < Stdioibz


Nt man O

pnint£ (Cfnten the numbeTS


A,B and C n 2 )
Scanf iL Ld JdZ411 LA, 2e,2Y
T (A2= 9LL A c)
p n i n t ECCC_d is_the qneates
Mumben \n2, A+
pmintf (CC Zd is the aneates
numben ml1, B)
If CC-A_ L2 z-A)
pmintfCZdis hegneqBest
numben \ 2
u2n_O-

autpUt
Entn he nummbee s_ A,Bandc-
30
20

B iS the qmeaie st_ umben.


PAGE
College ID-2o0o4 62(
Dqte' 09/o4/202 DATE
@O@O® =

2 f eise Statem en

The If elSe Statement1S nothing


buut h e exten Sion of Simple_f Sta
tementIf_expnession S muethan
finst blok wil eXelte OthenoiS e
SeCond_ blo ck

If (Condition)

mueblockStatament-

eiSe

falseblockStatemnent

Statemen-tY

Gi) Aloonithm
SRp 1 - S t a m t
Step - I n A u t A B
Step 3 - J H A z B _ t h e n gmeatan nunben
A

Sttp 4 f B 2 Atheg neatest Dumbe

Step 5= A/B_iS the gneatn nUmbep


Step 6 -Stop

PAGE
College LD-20 00 40(
Dqte- O5(o 4/202 DATE I
-@O®OOG-=

yPaoqn an

i n dude SAdio.b2
n t main O

int_A,B_
pmintf_( fnt ntoo NUmben s
A and B n'2)
SCanf(CZdZd1n,LA, B);
If (A 8)
pmintf /dis nean_nUm=
bem Am 12,A)

min C d1S 4Reqten DuMben


n 21, B)-
MetumD_O

Autput=
tuoo numbeDS A and BB_
0-

1S 0 gDegtn numbeY

PAGE
College Io-20004o2G
O@OOS= Dqte-05/04/202 DATE

Gii)FloLo ch ant
Stamt

Read A,B

Ldisplay8is NOTS YeS Displas A is 4


ASB
Sneaten NumberY Lgneaten Nunm ben/

EndkK

PAGE
College T0-20oo4o26

Ogte-5/o4/202 DATEII
9®O®OOG=

NeNested if elSe Statement

A_nested if n_C S an f State -


ment_ t h a t i s the tonget of anothen
f StCitemend NeSted ifStHatements-
meanS am if. Statanent_nSide an-
oth end StatementS uwe Can plate t
Statemest inside anoth.cn if statem en

Syntaz
1f ((onditlon

/Statement besn Condition 1 ae-


f CConditi.on )

StOtementrnt when Condition 1mue


else

I / Statemen+ ohen both CondD faise

ALgcmithm
Step 1 Stant
Step 2 Read A, 8_and C
Step 3=1fA 28.
if AC
display_ 6 Sgntaten numbem
PAGE
(oljege TD'200 o4o2 6
Oate o5/64/202 DATEII
®O@OOS-
eLS e
display CIS meat num be
elSe

Dispiay B e is thegmeatest num ber


eis e
DisplayCs the gneatest numben
Step_5-Sto

) Flowchant

Stan+

7Read , B7C

Ealse 4SA>e Tnue

S Toue
Fallse 1
FaTs 3

7ETS mea-
kateG
cisgoe Arst H u r Latest Hum
Otrct Nunb ber be
ber Num berd

S+oP
PAGE
Co)lege (ode:- 20004026
Dqte 05/o /202) DATE lI

-®@ODO®0=

Liy Pano.onam

i n dudr Stdio bz

int A, B,
pmintf (Enten hnee pumbDS\n)
SCamf (C /, d ZdLd2, LA, LB, 2 )
If CA> 8)

if (8 > O
pnintf d is gneateSt nuDben
An, A).
els e
pmintf(CLd_S QneQte Stnm be
\mi, C

elSe

f (82Q-
mintf Zd S meak St numbeD

else
pnlnf C7d 1s qpeatest number-
n2, cl,-

PAGE
College I0.-2o004 o26
Date- 05/04/202). DATE II
@O@DOO-=

OutpUt=-
EntD thnee numbers
Lo

30 1S neatest um bCD

eise=if Jadden
hene S anotheio nay of puHNG
f togetben whene multLpie_de-

ciSion malve. A multipiepath dei


Sion a chain_efit6 uwbich he
Statement assodiate. oith eathelS e
and at_eise

Suntax
f CConditim 1)

S+attment 1-

else if CConditlon 2

Statement 2

else 1f

else E

Stattment n,
PAGE
College 0-20oo4026
D C+e- 05/o4/202j DATE
@O®OOS-

i ALgopithm
Step Stant
S Read A,B,
Step 3 - i f A2B-0ndA Z
Display A IS gneatest Numben
else if BAand BZC
_display B1S gneatest numben_
PiSe
display is neatSt numben _
Step 4 Stopp
Gi) flOLO chamt--

Stan tF

Read A

A 8
Tue fa Ise

T a u e 2 8A
false

S 9neatesE
eafro usab7
Numb eD-

BS 9neaten
PAGE
SToP
College I0-2oo0 402c
Date- o5/04 /202 DATE
@OWOOS==

pnagm m -
indude <Stdio h
n t main (

int A, B,-
pnintt ( pnteD thee numbensn2,
Sçanf C ZdZLdz dl1 2 Le,2O
if (A>B LA>o
pmintf (6 7,d iS qmeatest um ben
n 1, A)

e1Se if C8 2A && R

Pnintf ( d is gneates numben


\m22, 8)

eiS
pninut (CEILd 1S0eatest Dumben
Am 22, c)-

Output-
Entem hnee Nunbems
13
20-

20 1sgntaiest numbe»

PAGE
(Olie ge IP 200o402
Dqte- o5/o4/202 DATE
9®O®OOG=

COnclusion-huS m thiG ay e have


lea») Ahot_Comoal StatenmemtS f
StatemeNt and thein flo wchamt,
algonithm a d pDOgM am

PAGE

You might also like