Wednesday, April 27, 2016

int to Float Datatype Conversion

using System;
namespace TypeConversionApplication 
{
 class ExplicitConversion 
 {
 static void Main(string[] args) 
 {
 int a = 40;
 float b = Convert.ToSingle(a);
 Console.WriteLine(b);
 Console.ReadKey();
 }
 }
}
Output : 40

int to String Datatype Conversion

using System;
namespace TypeConversionApplication 
{
 class ExplicitConversion 
 {
 static void Main(string[] args) 
 {
 int a = 66;
 string b = Convert.ToString(a);
 Console.WriteLine(b);
 Console.ReadKey();
 }  
 }
}
Output : 66

No comments: