parse decimal : Parse : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » Parse »

 

parse decimal








    
 
using System;

public class Class1 {
    public static void Main(string[] args) {
        Console.Write("Enter principal:");
        string sPrincipal = Console.ReadLine();
        decimal mPrincipal = decimal.Parse(sPrincipal);

        Console.Write("Enter interest:");
        string sInterest = Console.ReadLine();
        decimal mInterest = decimal.Parse(sInterest);

        decimal mInterestPaid;
        mInterestPaid = mPrincipal * (mInterest / 100);

        decimal mTotal = mPrincipal + mInterestPaid;

        Console.WriteLine("Principal     = " + mPrincipal);
        Console.WriteLine("Interest      = " + mInterest + "%");
        Console.WriteLine("Interest paid = " + mInterestPaid);
        Console.WriteLine("Total         = " + mTotal);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» Parse