3–2

`var total = 0`
`for i in 0...7 {   //控制行0~7`
`for j in 0...7{ //控制列0~7`
`total += i*j //每一格都是行Ｘ列 再把每隔加起來`
`}`
`}`

3–3

`var total = 0for i in 0...7 {`
`for j in 0...7{`
`if i%2 == 1{ //我們只需要基數行的 所以我們可以用取餘數的方式 如果行(i)取餘數等於1  代表是奇數行 我們才做相加  `
`total += i*j`
`}`
`}`
`}`

3–4

`var total = 0`
`for i in 0...7 {`
`for j in 0...7{`
`if j<i{   //除了列數>=行數的條件才相加`
`total += i*j`
`}`
`}`
`}`

3–5

`var total = 0func caclute(startNumber:Int,max:Int,number:Int)->Int{//function 3個Int傳入值 回傳一個Int`
`for i in startNumber...max {`
`if i%5 == 0{  total += i } //如題目 3~98 取5的餘數為0的相加`
`}`
`return total`
`}`
`caclute(startNumber: 3, max: 95, number: 5  )//傳入題目所需要的3個值`

3–6

`var total = 0func caclute2(startNumber:Int,max:Int,number:Int)->Int{`
`for i in startNumber...max{`
`if i%number != 0{ //如題目只要不是5的倍數`
`total += i`
`}`
`}`
`return total`
`}`
`caclute2(startNumber: 3, max: 11, number: 5 )`

3–7

`var total = 0func caclute3(row:Int,column:Int)->Int{`
`for i in 0...row{ //最大範圍改成輸入的row`
`for j in 0...column{//最大範圍改成輸入的column`
`if i%2 == 1{ //跟3-3完全一樣`
`total += i*j`
`}`
`}`
`}`
`return total`
`}`
`caclute3(row: 7, column: 7)`

3–8

`var total = 0func caclute4(row:Int,column:Int)->Int{`
`for i in 0...row {//最大範圍改成row`
`for j in 0...column{//最大範圍改成column`
`if j<i{ //和3-4一樣`
`total += i*j`
`}`
`}`
`}`
`return total`
`}`
`caclute4(row: 7, column: 7)`

3–9

c = (f — 32) * 5/9 公式來了

`func translate(f:Int)->Int{`
`var c = 0`
`c = (f - 32) * 5/9`
`return c`
`}`
`translate(f: 50 )`

Like what you read? Give AnD a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.