Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a Go program to calculate the factorial of numbers in parallel using goroutines.

Medium

Problem 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 }
Log in or sign up to run or submit your code.Log inSign up
Input
An array of numbers (e.g., [5, 6, 7]).
Expected Output
5040
120
720