In this example i’ll show you, how to find simple interest in C#.

This is a simple C# program that calculates the total amount of a loan given the principal amount, the number of years, and the rate of interest. When the program is run, it prompts the user to enter the loan amount, the number of years, and the rate of interest.

It then calculates the interest on the loan by multiplying the principal amount by the number of years by the rate of interest and divides the result by 100. The total amount of the loan is calculated by adding the interest to the principal amount.

Finally, the program outputs the total amount of the loan to the console and waits for the user to press the Enter key before ending.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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(); } } } |

**Output:**

1 2 3 4 5 6 |
Enter the Loan Amount : 1000 Enter the Number of Years : 3 Enter the Rate of Interest : 2 Total Amount : 1060 |