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

Python Record

The document describes an algorithm to find the factorial of a given number n using Python. It takes n as input, initializes i and fact to 1, and repeats multiplication of fact by i from 1 to n. It finally prints the factorial.

Uploaded by

Aravind G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Python Record

The document describes an algorithm to find the factorial of a given number n using Python. It takes n as input, initializes i and fact to 1, and repeats multiplication of fact by i from 1 to n. It finally prints the factorial.

Uploaded by

Aravind G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

SUM DF TwO NUMBE RS

Aim:
To find the Sum two numlbens USing pytn

ALUORITHM:

Stap 1 Stost tR progiam


Read the Value a and b
Stp
Stap 3 Calulate the Sum e a t b
PHint C
Step H
Sttp 5 Stop t p093am

PSEUDOLODE

Hhe numbn a and b


READ
Sum c :A t b
Calulate

WRITE C

STOP

PRURAM:

tha numba : " ) )


a int (Lput C° Ente
:"))
b: int Cinput (" Ent
the numb
c at b
two num bes is",c)
pHint ( The Sum of
FLOWCHART

Staeet
/Read the Value cß a,b

Caltulara Sun t:a +b

pint Valua o

Stop
RESDLT
UTPUT

Numb 20
Ento Ne

= 3D
Ertex #h numb
numb S 5D
The Sum twb
EVEN OR ODD NuMBER

Aim
OM Odd
T0 find whatR A the iven numb Van
USing Python

ALORITHM

the pHCq HAM


Stap St at
Raad tha Value o a
Stp 2

Stnp 3
Even numben )
St@p PHINt C
else
( Odd numb")
Step 3.2 :
pint
Stop the pHog1am
Step

PSEU DO CoDE
a
READ the hum bat
0 THEN
a-2
IF
WRITE Even numbi

ELSE
WATE Odd num bn

END

STOP
FLOWCHRRT

Stat

a
Read the Value o5

YES
NO if af2==o

Ccaa numbn Een numbe

Stop
PROCRAM:

a int Cînpu ("Erte he numb: "))

ta-a =0:
pint Even numbe ")

PAint C odd num bex")

RESULT:
Thus tha pHDgHam to find whe the t
givan
umb en O4 odd hou bRan wittan aund
ixatod Sucassfully.
oUTPUT
numbe:41
Ent the

Odd nuwnbe
LEAP YEAR OR o T

Aim:
1o find whsth he given

ot uSing Python

ALIORITHM:

Stat ta pAogam
Stap
Step 2 Read Value 59
o
Step 3: f yH
pAint laap yea ")
Step 3-1
else
3-2 : pAint ( Not a Leap yaax")
Step
Stop tPu pADgHam
Stap
PSEUDDLODE
tha num ben y
RE AD
FLOWCHART:

Staet

Rod +ha Valu oß y

yES

Not a teaP lapya

Stop
PROMRAM:
4 i t tinput ("Ent a yaa:"))

Pint ("Leap yaa")


elsa
purt (Not a Lap yaa")

RESULT
to find whethe
Thus pucgHamn
0 not has ben wuttan and
yas is Leap
9iven
exatnd SuLLAstully
OUTPUT
2004
Et a yga

Rap yQan
GtREATEST OF THREE NUMB ERS

Aim
To find t gmaatnst th numbous Using
Python

ALHORITHM

STEP 1 Statt
STEP 2: Read ab,c
u the umbesu
STEP 3: If a>b and c ,thn duplay a geatest
gmotst numba
STEP A ElSE if b>a,c duplay b ú tha
numbex
STEP 5: ELSE diplay u the 9 Hatust
STEP b: Stop

PSEUDO CODE
START

G1ET ab,l
IF 0sb AD aS c THEN
DISPLAY a the g0atust
b>a AND b>C THEN
ELSE IF
DISPLAY b tha Haatst
ELSE
DiSPLAYCu t e gHaata
ENDIF

STOP
FLONCHART

Staxt

Raad a,b.t

Y ES
abardc NO

int
YES baadc

Pirtb
PRDIRAM:

a-int Cinpu (" ant finst numbo: ")


b: int (input ( anto se and nume:)
C int input " ertsoi Thied numlo: "))
if asb and
pHint ( The gaatest numba , a)
I f b> c and a:
numb " , b)
pint C Te gucatust

numbu " , t)
paint (" The gecatest

RESULT
PAOgHam find + gatast of
Thus
lumbi
wsutten and x Rutad Succasssuly
OUTPOT:
numbæn: 4
Erta fst
nmbM 5
Ete secpnd

numban: 6
Ente t i d

th g a t s t rumbaæt
Aim
factoia f n USing python
To find th

LGHORITHM:
STEP Stat t pHOgHam
STEP 2 Raad the numbe n

STEP3 nitialige i , fact


STEP A: Repeat step to b unit he i :n
STEP 5 fact foct +1
i itl
STEP b
STE P 1: Point C" fatt ")
STEP S STOP

PSEUDD cODE
BE&IN
CET
Set i1 fact=i
WHILE Ci+n)

fact tat * i
iIt
END WHILE

D1SPLAY fact
END
HAR

Stavt

Rodn

ilfact

while
NO

Bent fact

fadfadi

ii+

StoP
PROC1RAM:
n: int linput (" Enton a numbe "))
i=
faur
while (tn):
fact fat *i
i i+1
pait ( Te factoual of."a, " is" , fact )

RESULT
Thus pOgHam to find u fadoual
wwttn and yautad Success fully
OUTPUT
a number : 5
Enton

You might also like