Steps Involved:
1. Use {0:e} to print exponential number.
2. Either use with WriteLine() or String.Format().
C# Program to Exponential Number:
using System;
using System.Text;
namespace TestConsole
{
class ExponentialFormat
{
static void Main(string[] args)
{
Console.WriteLine(String.Format("{0:e}", 1.3456));
Console.WriteLine(String.Format("{0:e}", -123.123));
//or
Console.WriteLine("{0:e}", 1000);
Console.ReadLine();
}
}
}
Output of Exponential number printing:
No comments:
Post a Comment