Author : Rahul

Write a program to calculate simple interest


Program:

using System;

namespace ProgrammingQuestion
{
 class Program
 {
   static void Main(string[] args)
   {
     //Variable Declaration
     string principleVal, rateVal, timeVal;
     double principle, rate, time, simpleInterest, amount;
     
     //User Input
     Console.Write("Enter Principle:");
     principleVal = Console.ReadLine();
     principle = Convert.ToDouble(principleVal);
     Console.Write("Enter Rate:");
     rateVal = Console.ReadLine();
     rate = Convert.ToDouble(rateVal);
     Console.Write("Enter Time:");
     timeVal = Console.ReadLine();
     time = Convert.ToDouble(timeVal);

     //Simple Interest Logic
     simpleInterest = (principle * rate * time) / 100;
     amount = principle + simpleInterest;
     
     //Print Result
     Console.WriteLine($"Simple Interest: {simpleInterest}");
     Console.WriteLine($"Total Amount: {amount}");
     Console.Read();
   }
 }
}

Output:

Enter Principle:10000
Enter Rate:5.7
Enter Time:3
Simple Interest: 1710
Total Amount: 11710