Back to Home

ABBA - Laboratory Work 0: Factorial (Vowels! * Consonants!)

ABBA vowels and consonants

ABBA: Agnetha, Bjorn, Benny, Anni (2 vowels, 2 consonants)

Total ways = Vowels! * Consonants!

!  *  !       Label

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()
    {
        Console.Write("Enter vowels: ");
        int v = int.Parse(Console.ReadLine());
        Console.Write("Enter consonants: ");
        int c = int.Parse(Console.ReadLine());
        Console.WriteLine(Factorial(v) * Factorial(c));
    }
}
    
Web hosting by Somee.com