Professional Documents
Culture Documents
Functions 2
Functions 2
factorial
ne Py
4 functions
a factorial
Given Point factorial
a
of N
Quiz 1
factH 1 2 3 4 24
a 1 2 3 4 to a
fact
11psweds Code
Public Static void main C L
int ans 1
int i t ie itt h
for i
n
ans i ans
3
System out pointer ans
re 4
int ans 1
i ien
ans sans i
I
2 t
3 3 4t
system out pointer ans
s
henit
11 C and Po
ng a
Quiz 2 5C 0
y ELI
10
Quiz 3 P t P Ig
Go
É
I PSuedo Code
P S v main C 4
Scanner Sen new Scanner system.in
int n Son next Inte
int r Sch neat Intl
int
fact
n I
int i is n it I
for Ig
n
fact nfactti
int act 1
ofinti I is o itt
for i
fact o
fact
3
mo
fact nm
fact is
g
int ans
fact fact
n nm
fact
System out Pointer ans
DRY Do not repeat yourself
to
function
I
buy screwdriver
I statement I
11 Statement 2
I
Public Static void mainC L
scannerson new Scannersystem.in scannerSen new Scannersystem.in
int n son neatIntel int n son neatIntel
fact n
for inti icon itt h intr f
public static int
ans i ans i fact
for inti ie n itt h
3 ans i ans i
mmmm
s return ans
z
Call Stock
Public Static void mainC L
scannerson new Scannersystem.in
int n son neatIntel
g systemout pointIn at
su 4
fft
mii
ÉÉ
if g
detumans main
ÉÉ
24
int n
fact fact
n
int a Co
fact fact
int hmm
fact fact n o
int ans
fact Efact
n
nonofact
System out pointer ans
return ans
3
Public Static void mainC L
scanner son new Scannersystem.in
I
int n son nextIntel
int o son nextIntel
of
int ans i nfact act
systemoutpointerans
nmofact
j
viiians ans imin so
many gigs
3
no 53 2
main C7 I
error
return at btc
Quiz 4
Public Static void main stringC args
packet
fits
Public Static int Product
I return atab
int a int b I
if y
15
no output
Quiz g
3
Quiz 68
int a int b 1 jÉ y 1