Posts

Showing posts from October, 2015

how to Replace null value with 0 Using C#

how to Replace null value with 0 Using C# //here we suppose that objDataTable have data collection as table now access this //datatable object. decimal  j = 0;  j = objDataTable.Rows[0]["Qty"] ==  DBNull .Value ? 0 :  Convert .ToDecimal(objDataTable.Rows[0]["Qty"]); NOTE :- //if   DBNull.value is null  then   "0 " else  "your code here")  // ? = then // : = else Thank You [Sumit Singh Shekhawat]

Calculate simple interst using c sharp in console application

Image
How to calculate SI (Simple Interest) using C# in Console Application _____________________ start _________________________ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Oops_Concepts {     class Program     {         static void Main()         {             Program objProgram = new Program();             objProgram.GetSimpleInterest();             Console.Read();               }          public void GetSimpleInterest()         {             double principle, interst = 0;             int time = 0;                          Console.Write("Enter Principle Am...

Calculate Mortgage in c# using console application

Formula :  M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1] M = monthly mortgage payment P = the principal, or the initial amount you borrowed. i = your monthly interest rate. Your lender likely lists interest rates as an annual figure, so you’ll need to divide by 12, for each month of the year. So, if your rate is 5%, then the monthly rate will look like this: 0.05/12 = 0.004167. n = the number of payments, or the payment period in months. If you take out a 30-year fixed rate mortgage, this means: n = 30 years x 12 months per year, or 360 payments. ___________________________________  Start Code  _________________________________ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Oops_Concepts {     class Program     {         static void Main(string[] args)         {             Program objProgram = new Program();   ...