Write a Go program to calculate the factorial of numbers in parallel using goroutines.
MediumProblem Statement
Write a Go program to calculate the factorial of numbers in parallel using goroutines.
Sample Input
An array of numbers (e.g., [5, 6, 7]).
Sample Output
5040 120 720
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
package main
import "fmt"
func calculateFactorial(n int, result chan int) {
// Calculate factorial and send the result to the channel
}
func main() {
// Launch goroutines to calculate factorials in parallel
}
Input
An array of numbers (e.g., [5, 6, 7]).
Expected Output
5040 120 720