C# Program to Find Simple Interest

This is a C# Program to calculate simple interest.

Problem Description

This C# Program Calculates Simple Interest.

Problem Solution

Here Simple interest is determined by multiplying the interest rate by the principal by the number of periods.

Program/Source Code

Here is source code of the C# Program to Calculate Simple Interest. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/*
 * 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();
 }
 }
}
Program Explanation

In this C# program, library function defined in header file is used. We are reading the loan amount, the number of years, and the rate of interest using ‘princamt’, ‘year’ and ‘rate’ variables respectively. To compute the simple interest following formula is used.

advertisement
advertisement

Simple Interest = princamt * rate * year / 100

Runtime Test Cases
 
Enter the Loan Amount : 1000
Enter the Number of Years : 3
Enter the Rate of Interest : 2
Total Amount : 1060

Sanfoundry Global Education & Learning Series – 1000 C# Programs.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
If you wish to look at all C# Programming examples, go to 1000 C# Programs.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.