csc101
-
Upload
victor-choo -
Category
Documents
-
view
214 -
download
2
description
Transcript of csc101
Sheet1Name: Sum 5 LineN1N2N3N4N5SumGiven: N1,N2,N3,N4,N511results: Total23definition : total= sum5(N1,N2,N3,N4,N5)35Get N147Get N259Get N3625Get N47output:25Get N5Let total = N1 +N2+N3+N4+N5give total : Name: Sum 5 LineN1N2N3N4N5sum AvgGiven: N1,N2,N3,N4,N511results: Total23definition : total= sum5(N1,N2,N3,N4,N5)35Get N147Get N259Get N3625Get N475Get N58output:25Let total = N1+N2+N3+N4+N59output:5Let average = sum/5give totalgive average Name: product 3LineN1N2N3 Productgiven: N1,N2,N3 12results : total29definition:total= multiply(N1,N2,N3)36Get N14108Get N25output:108Get N3 Let total = total = N1 X N2 X N3Give total :Name: Div/MulLineXYmultiply divideGiven: X,Y 12results: quotient29definition: quotient= multiply(x) x (y) 318divide [ (x) x (y)] /6 43Give multiply :5output:18Give division: 6output:3 Name: Calc MarkLineA1A2A3sum markGiven A1 ,A2.A3 115results: mark220definition: mark = calmark(A1,A2,A3)310set max mark:60445Get A1575Get A26output:75Get A3 Let total= A1+A2+A3Let mark= total /max mark x 100Give markName:SumDigLineNlet tenslet onessumGiven: N1659Results: sum265definition:sumdig(N)39Let tens : N div 10474Let ones: N mod 105output:74Let sum = tens + onesgive sumName: swapLineXY temp xtemp ygiven: x,y 18results: temp(x,y)29definition: swap (x,y)39get x48get y5output:9let temp = x6output:8let temp= ygive x =give y = Name: add wxyzLinewxyzsumgiven: w,x,y,z12results : x23definition add wxyz(w,x,y,z)34get w45get x514get y6output:14 get zlet= w+x+y+zgive x :
Sheet2
Sheet3