[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

formatting numbers

The code below is from the MSDN library.
.....
 Generate and display 5 random integers from 50 to 100.
Console.WriteLine("Five random integers between 50 and 100:")
For ctr As Integer = 0 To 4
   Console.Write("{0,8:N0}", rand.Next(50, 101))
Next
....      

Can someone please explain what exactly is meant by the ...

{0,8}  and by N0

Thank you

0
KarlTheHopeless
Asked:
KarlTheHopeless
1 Solution
 
nmarunCommented:
The zero is to show the first parameter - rand.Next(50, 101))
The eight says to reserve 8 columns of width
N0 means zero decimal places
0
 
KarlTheHopelessAuthor Commented:
thank you
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now