output - How do I display a row of random numbers in C# instead of a column? -
here program:
using system; using system.collections.generic; using system.linq; using system.text; namespace consoleapplicationlotto { class program { const int limit = 7; static void main(string[] args) { int[] lotto = new int[limit]; int lotdigits; random rnd = new random(); foreach (int sub in lotto) { lotdigits = rnd.next(0, 8); console.writeline(lotdigits); } } } }
i want display 7 random digits in row forming 7 digit "lotto number", "5902228" instead of:
5
9
0
2
2
2
8
i tried using "0:d7" , gives me bunch of zeroes last few digits being other numbers.
use console.write
instead of console.writeline
Comments
Post a Comment