Mode:
Duration:
1
2
3
4
5
6
function Factorial($n) {
if ($n -le 1) { return 1 }
else { return $n * (Factorial ($n - 1)) }
}
Write-Host "Factorial of 5: $(Factorial 5)"Coding works best on desktop or with an external keyboard.
function Factorial($n) {
if ($n -le 1) { return 1 }
else { return $n * (Factorial ($n - 1)) }
}
Write-Host "Factorial of 5: $(Factorial 5)"Coding works best on desktop or with an external keyboard.
Recursive factorial function.
function Factorial($n) {
if ($n -le 1) { return 1 }
else { return $n * (Factorial ($n - 1)) }
}
Write-Host "Factorial of 5: $(Factorial 5)"PowerShell is a cross-platform task automation and configuration management framework, combining a command-line shell, scripting language, and object-based pipeline built on .NET. It is widely used for DevOps, system administration, cloud automation, and enterprise workflows.
Origin & Creator
Created by Microsoft, originally released in 2006 as 'Monad' before becoming Windows PowerShell, then PowerShell Core (open-source).
Industrial Note
PowerShell dominates enterprise automation across Windows Server, Azure, Active Directory, Intune, Office 365, and hybrid-cloud DevOps environments.