Project 0
Introduction
This project demonstrates a recursive factorial
calculation in C#. The program asks the user
for the number of vowels and consonants and
calculates the result using factorials.
← Back to Home
C# Source Code
using System;
class ABBA
{
static int Factorial(int n)
{
if (n == 1) return 1;
return n * Factorial(n - 1);
}
static void Main(string[] args)
{
Console.WriteLine("ABBA!");
Console.Write("Enter number of vowels: ");
int vowels = int.Parse(Console.ReadLine());
Console.Write("Enter number of consonants: ");
int consonants = int.Parse(Console.ReadLine());
Console.WriteLine(
Factorial(vowels) *
Factorial(consonants)
);
}
}