Let Assume you have principle, rate and time given, you have to find the quarterly Compound Interest . Write a code for this.
Ashwani
using System;
class Program{ static void Main() { // Input values Console.Write(“Enter Principal: “); double principal = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter Rate of Interest: "); double rate = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter Time (in years): "); double time = Convert.ToDouble(Console.ReadLine()); // Quarterly Compound Interest calculation double amount = principal * Math.Pow((1 + (rate / (100 * 4))), 4 * time); double compoundInterest = amount - principal; // Output Console.WriteLine($"\nQuarterly Compound Interest = {compoundInterest:F2}"); Console.WriteLine($"Total Amount = {amount:F2}");}
Console.Write("Enter Rate of Interest: ");
double rate = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter Time (in years): ");
double time = Convert.ToDouble(Console.ReadLine());
// Quarterly Compound Interest calculation
double amount = principal * Math.Pow((1 + (rate / (100 * 4))), 4 * time);
double compoundInterest = amount - principal;
// Output
Console.WriteLine($"\nQuarterly Compound Interest = {compoundInterest:F2}");
Console.WriteLine($"Total Amount = {amount:F2}");
}
}using System;