Professional Documents
Culture Documents
CSC 101
CSC 101
CSC 101
Given: N1,N2,N3,N4,N5
results: Total
definition : total= sum5(N1,N2,N3,N4,N5)
Get N1
Get N2
Get N3
Get N4
Get N5
Let total = N1 +N2+N3+N4+N5
give total :
Line
Name: Sum 5
Given: N1,N2,N3,N4,N5
results: Total
definition : total= sum5(N1,N2,N3,N4,N5)
Get N1
Get N2
Get N3
Get N4
Get N5
Let total = N1+N2+N3+N4+N5
Let average = sum/5
give total
give average
Line
Name: product 3
given: N1,N2,N3
results : total
definition:total= multiply(N1,N2,N3)
Get N1
Get N2
Get N3
Let total = total = N1 X N2 X N3
Give total :
Line
Name: Div/Mul
Given: X,Y
results: quotient
definition: quotient= multiply(x) x (y)
divide [ (x) x (y)] /6
Give multiply :
Give division:
Line
Line
N1
N2
1
1
2
3
4
5
6
7 output:25
N1
N2
1
1
2
3
4
5
6
7
8 output:25
9 output:5
N1
N2
1
2
2
3
4
5 output:108
1
2
2
3
4
5 output:18
6 output:3
A1
1
2
3
A2
15
20
4
5
6 output:75
Name:SumDig
Given: N
Results: sum
definition:sumdig(N)
Let tens : N div 10
Let ones: N mod 10
Let sum = tens + ones
give sum
Line
Name: swap
given: x,y
results: temp(x,y)
definition: swap (x,y)
get x
get y
let temp = x
let temp= y
give x =
give y =
Line
Line
let tens
1
659
2
3
4
5 output:74
X
1
2
3
4
5 output:9
6 output:8
65
Y
8
w
1
2
2
3
4
5
6 output:14
x
3
N3
N4
N5
Sum
5
7
9
25
N3
N4
N5
sum
Avg
5
7
9
25
5
N3
Product
6
108
multiply
divide
18
3
A3
sum
10
mark
45
75
let ones
sum
9
74
temp x
temp y
9
8
sum
4
5
14