1
Reply

Let Assume you have principle, rate and time given, you have to find the quarterly Compound Interest . Write a code for this.

Ashwani

Ashwani

Sep 27
129
0
Reply

    using System;

    class Program
    {
    static void Main()
    {
    // Input values
    Console.Write(“Enter Principal: “);
    double principal = Convert.ToDouble(Console.ReadLine());

    1. Console.Write("Enter Rate of Interest: ");
    2. double rate = Convert.ToDouble(Console.ReadLine());
    3. Console.Write("Enter Time (in years): ");
    4. double time = Convert.ToDouble(Console.ReadLine());
    5. // Quarterly Compound Interest calculation
    6. double amount = principal * Math.Pow((1 + (rate / (100 * 4))), 4 * time);
    7. double compoundInterest = amount - principal;
    8. // Output
    9. Console.WriteLine($"\nQuarterly Compound Interest = {compoundInterest:F2}");
    10. Console.WriteLine($"Total Amount = {amount:F2}");
    11. }

    }
    using System;

    class Program
    {
    static void Main()
    {
    // Input values
    Console.Write(“Enter Principal: “);
    double principal = Convert.ToDouble(Console.ReadLine());

    1. Console.Write("Enter Rate of Interest: ");
    2. double rate = Convert.ToDouble(Console.ReadLine());
    3. Console.Write("Enter Time (in years): ");
    4. double time = Convert.ToDouble(Console.ReadLine());
    5. // Quarterly Compound Interest calculation
    6. double amount = principal * Math.Pow((1 + (rate / (100 * 4))), 4 * time);
    7. double compoundInterest = amount - principal;
    8. // Output
    9. Console.WriteLine($"\nQuarterly Compound Interest = {compoundInterest:F2}");
    10. Console.WriteLine($"Total Amount = {amount:F2}");
    11. }

    }