Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Level 6 > Lesson 9

package main
import "fmt"

func carpetNeeded(length int, breadth int, costPerSqFt int) (area int,costOfCarpeting int){
area = lengthbreadth
costOfCarpeting = area
costPerSqFt
return
}

func main() {
// use two variables - area & cost to store values returned
area,cost := carpetNeeded(12, 4, 5)
fmt.Printf("Area of floor is %d and cost of carpet will be %d", area, cost)
}

code submit nhi ho rha("Have you updated the function declaration to make it return two int values?')
yhi bta rha hai kya hai eska mtlb
by

3 Answers

iamabhishek
You have to return two values from 'carpetNeeded' using the 'return' statement, like this

return area, costOfCarpeting
rajnishsinghrajpoot
I tried sir .....ni ho rha .....sir can u plz provide me the whole code for this question only...i stuck here since yesterday
ayanali
func carpetNeeded(length int, breadth int, costPerSqFt int) (area int, costOfCarpeting int) {
area = length breadth
costOfCarpeting = area
costPerSqFt
return area, costOfCarpeting
}

Login / Signup to Answer the Question.