Calculate simple interst using c sharp in console application

How to calculate SI (Simple Interest) using C# in Console Application



_____________________ start _________________________


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Oops_Concepts
{
    class Program
    {

        static void Main()
        {
            Program objProgram = new Program();
            objProgram.GetSimpleInterest();
            Console.Read();      
        }

         public void GetSimpleInterest()
        {
            double principle, interst = 0;
            int time = 0;    
       
            Console.Write("Enter Principle Amount : ");
            principle = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter Interst Rate : ");
            interst = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter number of years : ");
            time = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Your Weekly Payment Amount is :" + GetSimpleInterest(principle, interst, time));
        }

        public double GetSimpleInterest(double principal, double interest, int timeInYears)
        {
            double si = 0;
            //formula : si = P*R*T
            si = principal * interest/100 * timeInYears;
            return si;
        }

    }
}



_____________________ end _________________________

Example : - 






Comments

Popular posts from this blog

Tree view in winforms using c#

how to Replace null value with 0 Using C#

how to fetch all HTML Table Records and modify all records accordingly using jquery and Javascript