Tuesday, April 26, 2016

int to Decimal Datatype Conversion

using System;
namespace TypeConversionApplication 
{
 class ExplicitConversion 
 {
 static void Main(string[] args) 
 {
 int a = 20;
 decimal b = Convert.ToDecimal(a);
 Console.WriteLine(b);
 Console.ReadKey();
 }
 }
}
Output : 20
 int to Double Datatype
using System;
namespace TypeConversionApplication 
{
 class ExplicitConversion 
 {
 static void Main(string[] args) 
 {
 int a = 30;
 double b = Convert.ToDouble(a);
 Console.WriteLine(b);
 Console.ReadKey();
 }
 }
}
Output : 30

No comments: