C#.NET Multiple choices


Total available count: 28
Subject - Microsoft Technologies
Subsubject - C#.NET

How to print currency value in C#.Net?


 

 

 

 



C


Solution:-

C# Currency ("C") Format Specifier
To convert a number to a string we use the "C" (or currency) format specifier and it is representing a currency amount.

Let us see an example as follows.

double value = 175.87;

Now to display the above number until three decimal places, use (“C3”) currency format specifier.

value.ToString("C3", CultureInfo.CurrentCulture)

Let us see another example as follows,

using System;
using System.Globalization;
class Demo {
  static void Main() {
    double value = 275.66;
    // displays $
    Console.WriteLine(value.ToString("C", CultureInfo.CurrentCulture));
    Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));
 }
}

The output of the above code is as follows:
$275.66
$275.660




Next 5 multiple choice(s)

1

Which of the following declaration is wrong?

2

How to use a keyword as an identifier?

3

Which of the following access modifier added in C# 7.2?

4

Which of the following keyword is quite opposite to sealed?

5

Which of the following notation is incorrect?

Comments