In this code we will try to understand how to find Frequencies in C#. Hope it will help you.
Program:
using System;
class ElectricalCircuit
{
public static void Main()
{
float L,R,C,Frequency;
// L = Inductance
// R = Resistance
// C = Capacitance
//double Frequency;
Console.WriteLine(" ****** Calculating frequencies for different values of Capacitance ******");
Console.WriteLine(""); // Blank Line
Console.Write("Enter the Inductance (L) : ");
L = float.Parse(Console.ReadLine());
Console.Write("Enter the Resistance (R) : ");
R = float.Parse(Console.ReadLine());
Console.WriteLine(""); // Blank Line
for (C = 0.01F; C <= 0.1; C = C + 0.01F)
{
Frequency = (float)(Math.Sqrt((1/L*C)-((R*R)/(4*C*C))));
Console.WriteLine("For Capacitance " + C + ", The Frequency = " + Frequency);
}
Console.ReadLine();
}
}