All Type Coding

Search Here

How do I calculating simple principle of an amount by using its rate of interest and no of years in c#.?

using System;

class abc
{
    int amount, roi, noy, pri;
    public void prin()
    {
        Console.WriteLine("Program for calculating principle of a given amount :");
        Console.WriteLine("Enter amount :");
        amount = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter rate of interest to be paid :");
        roi = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Enter number of years for which amount has been taken :");
        noy = Convert.ToInt32(Console.ReadLine());
        pri = (amount * roi * noy) / 100;
        Console.WriteLine("Principle is :" + pri);
        Console.ReadKey();
    }
}
class pri1
{
    public static void Main(string[] args)
    {
        abc a = new abc();
        a.prin();
    }

}
Output:


No comments :

Post a Comment