using System; namespace TypeConversionApplication { class ExplicitConversion { static void Main(string[] args) { decimal a = 10.0M; int b = Convert.ToInt32(a); Console.WriteLine(b); Console.ReadKey(); } } }
Output : 10
Decimal to Float Datatype Conversion
using System; namespace TypeConversionApplication { class ExplicitConversion { static void Main(string[] args) { decimal a = 20.0M; float b = Convert.ToSingle(a); Console.WriteLine(b); Console.ReadKey(); } } }
Output : 20
No comments:
Post a Comment