Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count(r,c,1,0)
- def count(r: Int, c: Int, countR: Int, lalaCount: Int): Int = {
- if (countR < (r + 1)) count(r,c,countR + 1, lalaCount + countR)
- else (lalaCount + c + 1)
- }
- object hw1 {
- def pascal(c: Int, r: Int): Int = {
- count(r,c,1,0)
- def count(r: Int, c: Int, countR: Int, lalaCount: Int): Int = {
- if (countR < (r + 1)) count(r,c,countR + 1, lalaCount + countR)
- else (lalaCount + c + 1)
- }
- } //On this line eclipse is saying "Multiple markers at this line
- //- type mismatch; found : Unit required: Int
- //- type mismatch; found : Unit required: Int
- pascal(3,4)
- def pascal(c: Int, r: Int): Int = {
- count(r,c,1,0) // => Int
- def count(r: Int, c: Int, countR: Int, lalaCount: Int): Int = {
- if (countR < (r + 1)) count(r,c,countR + 1, lalaCount + countR)
- else (lalaCount + c + 1)
- } // => Unit
- }
Add Comment
Please, Sign In to add comment