Question:
how can i Create a C# Console Application program that will accept a whole number as input?
paolosports
2010-03-19 01:30:03 UTC
how can i Create a C# Console Application program that will accept a whole number as input?
Three answers:
Tenax
2010-03-19 01:57:42 UTC
Just read in a string with

String s = System.Console.ReadLine()

and then convert that using

int i = Convert.ToInt32(s);

You may have to catch possible exceptions and repeat the input until you get an integer, or alternatively have the user input character by character and build the input string yourself.

It all depends what exactly you need, you gave little information about that.
2016-11-29 12:05:19 UTC
i'm searching for an identical please positioned up up once you get the respond. i will show you how to be responsive to that the respond published can't be ideal with the aid of there being no do assertion. you go with a do jointly as assertion which will desire to look something like this. { do assertion a million assertion 2 assertion n }jointly as
Tasm
2010-03-19 02:14:58 UTC
You get the string from an inputbox.



int x = System.Covert.ToInt32(inputbox.text);


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...