logo image

C# program to calculate interest

Views: 15

Following program shows you how to calculate interest. In this program we get investment, interest rate and time from user and calculate interest using following formula Interest = investment X interestRate X time / 100

using System;

class MainClass {
  public static void Main (string[] args) {
    Console.WriteLine("Enter investment:");
    int investment = Convert.ToInt32(Console.ReadLine());
    Console.WriteLine("Enter interest rate:");
    int interestRate = Convert.ToInt32(Console.ReadLine());
    Console.WriteLine("Enter number of years:");
    int time = Convert.ToInt32(Console.ReadLine());
    int interest = investment * interestRate * time / 100;
    Console.WriteLine("Interest amount is: " + interest);


Enter investment:
Enter interest rate:
Enter number of years:
Interest amount is: 120000