programming-examples/c-sharp/Mathematics/C# Program to Calculate Simple Interest.cs

30 lines
865 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C# Program to Calculate Simple Interest
*/
using System;
namespace Interest
{
class Program
{
static void Main(string[] args)
{
int year;
double princamt,rate, interest, total_amt;
Console.Write("Enter The Loan Amount : ");
princamt = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter The Number of Years : ");
year = Convert.ToInt16(Console.ReadLine());
Console.Write("Enter the Rate Of Interest : ");
rate = Convert.ToDouble(Console.ReadLine());
interest = princamt * year * rate / 100;
total_amt = princamt + interest;
Console.WriteLine("Total Amount : {0}", total_amt);
Console.ReadLine();
}
}
}
/*
Enter the Loan Amount : 1000
Enter the Number of Years : 3
Enter the Rate of Interest : 2
Total Amount : 1060