CSharp examples for Language Basics:decimal
Create decimal array
using System;/* w ww. j av a2s . com*/ class SimpleAccountBalances { public static void Main() { const decimal interestRate = 0.1m; decimal [] accountBalances; accountBalances = new decimal [5]; Console.WriteLine("Please enter two account balances: "); Console.Write("First balance: "); accountBalances[0] = Convert.ToDecimal(Console.ReadLine()); Console.Write("Second balance: "); accountBalances[1] = Convert.ToDecimal(Console.ReadLine()); accountBalances[0] = accountBalances[0] + accountBalances[0] * interestRate; accountBalances[1] = accountBalances[1] + accountBalances[1] * interestRate; Console.WriteLine("New balances after interest: "); Console.WriteLine("First balance: {0:C}", accountBalances[0]); Console.WriteLine("Second balance: {0:C}", accountBalances[1]); } }