I have an integer variable .if its 1-9 it only displays as "1" or "9", I'm looking to convert the variable to save as 3 digits, ie. "001", or "009", etc. any ideas? I am using C#,ASP.Net
Hence, there are 900 three-digit numbers in total.
Get input num from user using input() method check whether the num is greater than 99 and less than 100 using if statement. if it is true, then print num is three digit number using print() method. Else print num is not three digit number using print() method.
So there are 90 total.
use
int X = 9;
string PaddedResult = X.ToString().PadLeft (3, '0'); // results in 009
see MSDN references here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With