find simple interest c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace intrest
{
class si
{
public int p, n, r;
public int getdata(int x, int y, int z)
{
int b;
p = x;
n = y;
r = z;
b= p * n * r / 100;
return(b);
}
}
class Program
{
static void Main(string[] args)
{
int a, b,c;
si i = new si();
Console.WriteLine("Enter principal amount:");
a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter rate:");
b = int.Parse(Console.ReadLine());
Console.WriteLine("Enter time in year:");
c = int.Parse(Console.ReadLine());
int simple_intrest = i.getdata(a,b,c);
Console.WriteLine("simple intrest={0} of principal={1}", simple_intrest,a);
Console.ReadKey();
}
}
}
Output
Enter principal amount:
20000
Enter rate:
5
Enter time in year:
4
simple intrest=4000 of principal=20000
Comments
Post a Comment